name: Create Tag and Release on: workflow_dispatch: inputs: tag: description: "Release tag (required, e.g. v0.2.0)" required: true type: string prerelease: description: "Mark as pre-release" required: false type: boolean default: false draft: description: "Create as draft" required: false type: boolean default: false jobs: create-tag: name: Create Git Tag runs-on: ubuntu-latest permissions: contents: write steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 - name: Create and push tag shell: bash run: | git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" git tag -a "${{ inputs.tag }}" -m "Release ${{ inputs.tag }}" git push origin "${{ inputs.tag }}" release: name: GoReleaser Release needs: create-tag runs-on: ubuntu-latest permissions: contents: write packages: write steps: - name: Checkout tag uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ inputs.tag }} - name: Setup Go from go.mod uses: actions/setup-go@v5 with: go-version-file: go.mod - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Login to Docker Hub uses: docker/login-action@v3 with: registry: docker.io username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Run GoReleaser uses: goreleaser/goreleaser-action@v6 with: distribution: goreleaser version: ~> v2 args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }} DOCKERHUB_IMAGE_NAME: ${{ vars.DOCKERHUB_REPOSITORY }} - name: Apply release flags shell: bash env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | gh release edit "${{ inputs.tag }}" \ --draft=${{ inputs.draft }} \ --prerelease=${{ inputs.prerelease }}