ci: migrate ci-cd pipeline from github to gitea registry
This commit is contained in:
+13
-14
@@ -5,11 +5,11 @@ on:
|
|||||||
branches: [main]
|
branches: [main]
|
||||||
|
|
||||||
env:
|
env:
|
||||||
REGISTRY: ghcr.io
|
REGISTRY: gitea.nasvincent.com
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-22.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-python@v5
|
- uses: actions/setup-python@v5
|
||||||
@@ -27,8 +27,7 @@ jobs:
|
|||||||
|
|
||||||
build-and-push:
|
build-and-push:
|
||||||
needs: test
|
needs: test
|
||||||
environment: DEV
|
runs-on: ubuntu-22.04
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
packages: write
|
packages: write
|
||||||
@@ -47,8 +46,8 @@ jobs:
|
|||||||
- uses: docker/login-action@v3
|
- uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: ${{ env.REGISTRY }}
|
registry: ${{ env.REGISTRY }}
|
||||||
username: ${{ github.actor }}
|
username: ${{ secrets.USERNAME }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.TOKEN }}
|
||||||
- uses: docker/build-push-action@v5
|
- uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
@@ -57,17 +56,17 @@ jobs:
|
|||||||
tags: |
|
tags: |
|
||||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.new_version }}
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.new_version }}
|
||||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
||||||
cache-from: type=gha
|
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache,mode=max
|
||||||
- name: Create Git tag
|
- name: Create Git tag
|
||||||
run: |
|
run: |
|
||||||
git config user.email "action@github.com"
|
git config user.email "action@gitea.nasvincent.com"
|
||||||
git config user.name "GitHub Action"
|
git config user.name "Gitea Action"
|
||||||
git tag ${{ steps.version.outputs.new_version }}
|
git tag ${{ steps.version.outputs.new_version }}
|
||||||
git push origin ${{ steps.version.outputs.new_version }}
|
git push origin ${{ steps.version.outputs.new_version }}
|
||||||
- name: Save new minor version
|
- name: Save new minor version
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ secrets.PAT_ADMIN_TOKEN }}
|
|
||||||
GH_REPO: ${{ github.repository }}
|
|
||||||
run: |
|
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