ci: migrate ci-cd pipeline from github to gitea registry
This commit is contained in:
+13
-14
@@ -5,11 +5,11 @@ on:
|
||||
branches: [main]
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
REGISTRY: gitea.nasvincent.com
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
@@ -27,8 +27,7 @@ jobs:
|
||||
|
||||
build-and-push:
|
||||
needs: test
|
||||
environment: DEV
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-22.04
|
||||
permissions:
|
||||
contents: write
|
||||
packages: write
|
||||
@@ -47,8 +46,8 @@ jobs:
|
||||
- uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
username: ${{ secrets.USERNAME }}
|
||||
password: ${{ secrets.TOKEN }}
|
||||
- uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
@@ -57,17 +56,17 @@ jobs:
|
||||
tags: |
|
||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.new_version }}
|
||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache
|
||||
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache,mode=max
|
||||
- name: Create Git tag
|
||||
run: |
|
||||
git config user.email "action@github.com"
|
||||
git config user.name "GitHub Action"
|
||||
git config user.email "action@gitea.nasvincent.com"
|
||||
git config user.name "Gitea Action"
|
||||
git tag ${{ steps.version.outputs.new_version }}
|
||||
git push origin ${{ steps.version.outputs.new_version }}
|
||||
- name: Save new minor version
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.PAT_ADMIN_TOKEN }}
|
||||
GH_REPO: ${{ github.repository }}
|
||||
run: |
|
||||
gh variable set VERSION_MINOR --body "${{ steps.version.outputs.new_minor }}" --env DEV
|
||||
curl -s -X PUT "https://gitea.nasvincent.com/api/v1/repos/${{ github.repository }}/actions/variables/VERSION_MINOR" \
|
||||
-H "Authorization: token ${{ secrets.TOKEN }}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"value\": \"${{ steps.version.outputs.new_minor }}\"}"
|
||||
|
||||
Reference in New Issue
Block a user