From 17a54633bcf4b0b658df214ba31148482e04d339 Mon Sep 17 00:00:00 2001 From: alphayax Date: Sat, 26 Apr 2025 15:45:58 +0200 Subject: [PATCH 1/2] Add Docker publishing workflow for tagged releases Introduces a new GitHub Actions job to build and publish Docker images for tagged releases. The workflow logs in to the GitHub Container Registry, generates metadata, sets up Buildx, and pushes the images with appropriate tags and caching. This change streamlines Docker image distribution for the repository. --- .github/workflows/rust.yml | 49 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index bfe6b36a..c6218be0 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -205,6 +205,55 @@ jobs: env: NODE_AUTH_TOKEN: ${{secrets.npm_token}} + publish-docker: + if: startsWith(github.ref, 'refs/tags/') + #needs: [build-linux-x64, build-mac, build-windows] + needs: pre_job + runs-on: ubuntu-22.04 + permissions: + contents: read + packages: write + attestations: write + id-token: write + env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Log in to the Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=ref,event=branch + type=sha + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max + lint: needs: pre_job if: needs.pre_job.outputs.should_skip != 'true' From 6629ef3fe36dba2b9aab7cbc80f33f901ec085f7 Mon Sep 17 00:00:00 2001 From: alphayax Date: Sat, 26 Apr 2025 16:03:30 +0200 Subject: [PATCH 2/2] Update publish-docker dependencies and tagging configuration Revert to correct job dependencies for publish-docker by including all build steps. Added 'latest' tag configuration to streamline Docker image tagging. --- .github/workflows/rust.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index c6218be0..76075b87 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -207,8 +207,7 @@ jobs: publish-docker: if: startsWith(github.ref, 'refs/tags/') - #needs: [build-linux-x64, build-mac, build-windows] - needs: pre_job + needs: [build-linux-x64, build-mac, build-windows] runs-on: ubuntu-22.04 permissions: contents: read @@ -238,6 +237,7 @@ jobs: type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}} + type=raw,value=latest type=ref,event=branch type=sha