Configure CI workflow to run only on GitHub and improve Docker tagging strategy
CI/CD Pipeline / Test (push) Has been cancelled
CI/CD Pipeline / Lint (push) Has been cancelled
CI/CD Pipeline / Build and Push Docker Image (push) Has been cancelled

- Add github.server_url check to prevent workflow execution on Gitea
- Implement clear separation between development (latest) and production (stable) tags
- Use stable tag only for versioned releases (v*)
- Add sha- prefix to commit-based tags for better clarity
- Remove redundant branch name tags
This commit is contained in:
2025-11-27 21:28:21 +01:00
parent 7cb2756b67
commit cb467c688a
+5 -3
View File
@@ -11,6 +11,7 @@ jobs:
test:
name: Test
runs-on: ubuntu-latest
if: github.server_url == 'https://github.com'
steps:
- uses: actions/checkout@v4
@@ -34,6 +35,7 @@ jobs:
lint:
name: Lint
runs-on: ubuntu-latest
if: github.server_url == 'https://github.com'
steps:
- uses: actions/checkout@v4
@@ -57,7 +59,7 @@ jobs:
name: Build and Push Docker Image
runs-on: ubuntu-latest
needs: [test, lint]
if: github.event_name == 'push'
if: github.event_name == 'push' && github.server_url == 'https://github.com'
permissions:
contents: read
packages: write
@@ -78,10 +80,10 @@ jobs:
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=ref,event=branch
type=ref,event=tag
type=sha
type=sha,prefix=sha-
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value=stable,enable=${{ startsWith(github.ref, 'refs/tags/v') }}
- name: Build and push
uses: docker/build-push-action@v5