From dbbf9df02dd2db0e7f27de46bf324874525de841 Mon Sep 17 00:00:00 2001 From: Stephen Simpson Date: Tue, 29 Apr 2025 16:26:48 -0700 Subject: [PATCH] fix: update workflow name and improve Docker metadata extraction steps Signed-off-by: Stephen Simpson --- .gitea/workflows/docker-image-linux.yml | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/.gitea/workflows/docker-image-linux.yml b/.gitea/workflows/docker-image-linux.yml index 00b6dda..d4dfb71 100644 --- a/.gitea/workflows/docker-image-linux.yml +++ b/.gitea/workflows/docker-image-linux.yml @@ -1,4 +1,5 @@ -name: Create and publish a Docker image for Linux +name: Build and publish Docker image + on: push: branches: @@ -6,21 +7,21 @@ on: - master tags: - '*.*.*' - workflow_dispatch: # Keep manual trigger for testing + workflow_dispatch: env: REGISTRY: gitea.sjs.io - GITHUBUSER: ${{ gitea.repository_owner }} IMAGE_NAME: rocky-dev jobs: - build-and-push-image: + build-and-push: runs-on: ubuntu-latest permissions: contents: read packages: write + steps: - - name: Checkout repository + - name: Checkout code uses: actions/checkout@v4 - name: Set up QEMU @@ -29,22 +30,26 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Login to GitHub Container Registry + - name: Log in to registry uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ vars.USERNAME }} password: ${{ secrets.PASS }} - - name: Extract metadata for Docker + - name: Extract Docker metadata id: meta uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ vars.USERNAME }}/${{ env.IMAGE_NAME }} tags: | - ${{ env.env.GITHUB_REF_NAME }} - - - name: Build and push both architectures + # Only tag with version and latest on tag push + type=semver,pattern={{version}},enable=${{ startsWith(github.ref, 'refs/tags/') }} + type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') }} + # Optionally, tag dev/master builds with branch name (for testing) + type=ref,event=branch,enable=${{ !startsWith(github.ref, 'refs/tags/') }} + + - name: Build and push Docker image uses: docker/build-push-action@v6 with: context: .