Create Release #16
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: Create Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| bump_type: | |
| description: 'Version bump type' | |
| required: true | |
| default: 'patch' | |
| type: choice | |
| options: | |
| - major | |
| - minor | |
| - patch | |
| permissions: | |
| contents: write | |
| packages: write | |
| jobs: | |
| create-release: | |
| name: Create Tag and Release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| cache: true | |
| - name: Bump version and create tag | |
| id: tag | |
| uses: anothrNick/github-tag-action@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| DEFAULT_BUMP: ${{ github.event.inputs.bump_type }} | |
| TAG_PREFIX: v | |
| VERBOSE: true | |
| - name: Run GoReleaser | |
| uses: goreleaser/goreleaser-action@v6 | |
| if: steps.tag.outputs.new_tag != '' | |
| with: | |
| version: latest | |
| distribution: goreleaser | |
| args: release --clean | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Docker meta | |
| id: meta | |
| if: steps.tag.outputs.new_tag != '' | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ github.repository }} | |
| tags: | | |
| type=semver,pattern={{version}},value=${{ steps.tag.outputs.new_tag }} | |
| type=semver,pattern={{major}}.{{minor}},value=${{ steps.tag.outputs.new_tag }} | |
| type=semver,pattern={{major}},value=${{ steps.tag.outputs.new_tag }} | |
| latest | |
| - name: Set up Docker Buildx | |
| if: steps.tag.outputs.new_tag != '' | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GitHub Container Registry | |
| if: steps.tag.outputs.new_tag != '' | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up QEMU | |
| if: steps.tag.outputs.new_tag != '' | |
| uses: docker/setup-qemu-action@v3 | |
| with: | |
| platforms: 'arm64,amd64,arm' | |
| - name: Build and push Docker image | |
| if: steps.tag.outputs.new_tag != '' | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| push: true | |
| platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| provenance: true | |
| sbom: true | |
| build-args: | | |
| BUILDKIT_INLINE_CACHE=1 | |
| env: | |
| GO_VERSION: "1.24" | |
| REGISTRY: ghcr.io |