Release #203
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: Release | |
| on: | |
| workflow_run: | |
| workflows: ["Test"] | |
| types: [completed] | |
| permissions: | |
| contents: write | |
| packages: write | |
| jobs: | |
| check: | |
| name: Check Tag | |
| runs-on: ubuntu-latest | |
| if: >- | |
| github.event.workflow_run.conclusion == 'success' && | |
| github.event.workflow_run.event == 'push' && | |
| startsWith(github.event.workflow_run.head_branch, 'v') | |
| outputs: | |
| tag: ${{ steps.tag.outputs.tag }} | |
| steps: | |
| - name: Extract tag | |
| id: tag | |
| run: echo "tag=${{ github.event.workflow_run.head_branch }}" >> "$GITHUB_OUTPUT" | |
| build-image: | |
| name: Build Docker (${{ matrix.arch }}) | |
| runs-on: ${{ matrix.runner }} | |
| needs: [check] | |
| strategy: | |
| matrix: | |
| include: | |
| - platform: linux/amd64 | |
| runner: ubuntu-latest | |
| arch: amd64 | |
| - platform: linux/arm64 | |
| runner: ubuntu-24.04-arm | |
| arch: arm64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ needs.check.outputs.tag }} | |
| - uses: docker/setup-buildx-action@v3 | |
| - uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Docker metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/${{ github.repository }} | |
| tags: | | |
| type=semver,pattern={{version}},value=${{ needs.check.outputs.tag }} | |
| type=semver,pattern={{major}}.{{minor}},value=${{ needs.check.outputs.tag }} | |
| type=semver,pattern={{major}},value=${{ needs.check.outputs.tag }} | |
| flavor: | | |
| suffix=-${{ matrix.arch }},onlatest=true | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| platforms: ${{ matrix.platform }} | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| provenance: false | |
| build-args: | | |
| VERSION=${{ needs.check.outputs.tag }} | |
| merge-manifests: | |
| name: Merge Docker Manifests | |
| runs-on: ubuntu-latest | |
| needs: [check, build-image] | |
| steps: | |
| - uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Docker metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/${{ github.repository }} | |
| tags: | | |
| type=semver,pattern={{version}},value=${{ needs.check.outputs.tag }} | |
| type=semver,pattern={{major}}.{{minor}},value=${{ needs.check.outputs.tag }} | |
| type=semver,pattern={{major}},value=${{ needs.check.outputs.tag }} | |
| - name: Create and push multi-arch manifest | |
| run: | | |
| echo "${{ steps.meta.outputs.tags }}" | while IFS= read -r tag; do | |
| [ -z "$tag" ] && continue | |
| echo "Creating manifest for: ${tag}" | |
| docker buildx imagetools create -t "${tag}" \ | |
| "${tag}-amd64" \ | |
| "${tag}-arm64" || exit 1 | |
| done | |
| github-release: | |
| name: GitHub Release | |
| runs-on: ubuntu-latest | |
| needs: [check, merge-manifests] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ needs.check.outputs.tag }} | |
| - name: Create release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ needs.check.outputs.tag }} | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |