Merge pull request #69 from encryption4all/release-plz-2026-03-27T08-… #92
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Delivery | |
| on: | |
| push: | |
| branches: [main] | |
| tags: ['v*'] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| packages: write | |
| security-events: write | |
| jobs: | |
| build-amd64: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| digest: ${{ steps.build.outputs.digest }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Select build profile | |
| id: config | |
| run: | | |
| if [[ "${{ github.ref }}" == refs/tags/v* ]]; then | |
| echo "profile=release" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "profile=edge" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v4 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push (linux/amd64) | |
| id: build | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| platforms: linux/amd64 | |
| push: true | |
| provenance: false | |
| tags: ghcr.io/${{ github.repository }}:build-${{ github.run_id }}-amd64 | |
| build-args: CARGO_PROFILE=${{ steps.config.outputs.profile }} | |
| cache-from: type=gha,scope=build-amd64 | |
| cache-to: type=gha,mode=max,scope=build-amd64 | |
| - name: Scan image | |
| uses: anchore/scan-action@7037fa011853d5a11690026fb85feee79f4c946c # v7.3.2 | |
| id: scan | |
| with: | |
| image: ghcr.io/${{ github.repository }}:build-${{ github.run_id }}-amd64 | |
| only-fixed: true | |
| fail-build: true | |
| severity-cutoff: critical | |
| output-format: sarif | |
| - name: Upload Anchore scan SARIF report | |
| uses: github/codeql-action/upload-sarif@c793b717bc78562f491db7b0e93a3a178b099162 # v4 | |
| if: ${{ !cancelled() }} | |
| with: | |
| sarif_file: ${{ steps.scan.outputs.sarif }} | |
| build-arm64: | |
| runs-on: ubuntu-24.04-arm | |
| outputs: | |
| digest: ${{ steps.build.outputs.digest }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Select build profile | |
| id: config | |
| run: | | |
| if [[ "${{ github.ref }}" == refs/tags/v* ]]; then | |
| echo "profile=release" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "profile=edge" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v4 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push (linux/arm64) | |
| id: build | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| platforms: linux/arm64 | |
| push: true | |
| provenance: false | |
| tags: ghcr.io/${{ github.repository }}:build-${{ github.run_id }}-arm64 | |
| build-args: CARGO_PROFILE=${{ steps.config.outputs.profile }} | |
| cache-from: type=gha,scope=build-arm64 | |
| cache-to: type=gha,mode=max,scope=build-arm64 | |
| merge: | |
| runs-on: ubuntu-latest | |
| needs: [build-amd64, build-arm64] | |
| steps: | |
| # No checkout needed: docker/metadata-action reads from the GitHub Actions context. | |
| - name: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@v6 | |
| with: | |
| images: ghcr.io/${{ github.repository }} | |
| tags: | | |
| type=semver,pattern={{version}},event=tag | |
| type=semver,pattern={{major}}.{{minor}},event=tag | |
| type=edge,enable=${{ !startsWith(github.ref, 'refs/tags/') }} | |
| type=ref,event=pr | |
| type=ref,event=branch,enable=${{ github.event_name == 'workflow_dispatch' }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v4 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| # Combine the two platform-specific images into a single multi-arch manifest. | |
| # DOCKER_METADATA_OUTPUT_JSON is set automatically by docker/metadata-action. | |
| - name: Create and push multi-arch manifest | |
| run: | | |
| docker buildx imagetools create \ | |
| $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ | |
| "ghcr.io/${{ github.repository }}@${{ needs.build-amd64.outputs.digest }}" \ | |
| "ghcr.io/${{ github.repository }}@${{ needs.build-arm64.outputs.digest }}" |