Create release #1
This file contains 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: | |
jobs: | |
release: | |
permissions: | |
contents: "write" | |
id-token: "write" | |
packages: "write" | |
pull-requests: "read" | |
name: release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout action code | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
fetch-depth: 0 | |
- name: Draft release | |
id: draft_release | |
uses: release-drafter/release-drafter@3f0f87098bd6b5c5b9a36d49c41d998ea58f9348 # v6.0.0 | |
with: | |
disable-autolabeler: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build Docker image | |
run: VERSION=${{ steps.draft_release.outputs.tag_name }} make docker-push | |
- name: Publish release | |
uses: release-drafter/release-drafter@3f0f87098bd6b5c5b9a36d49c41d998ea58f9348 # v6.0.0 | |
if: steps.draft_release.outputs.tag_name != '' | |
with: | |
version: ${{ steps.draft_release.outputs.tag_name }} | |
publish: true | |
disable-autolabeler: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create GitHub App Token | |
id: app-token | |
uses: actions/create-github-app-token@86576b355dd19da0519e0bdb63d8edb5bcf76a25 # v1.6.0 | |
with: | |
app-id: ${{ secrets.VERSION_CLI_UPDATER_APP_ID }} | |
private-key: ${{ secrets.VERSION_CLI_UPDATER_PRIVATE_KEY }} | |
- name: Checkout action code | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
fetch-depth: 0 | |
ref: ${{ steps.draft_release.outputs.tag_name }} | |
- name: Setup Go environment | |
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | |
with: | |
go-version-file: "go.mod" | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v2.0.0 | |
with: | |
version: latest | |
args: release --skip=publish --clean | |
env: | |
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | |
GORELEASER_CURRENT_TAG: ${{ steps.draft_release.outputs.tag_name }} | |
- name: Upload files | |
run: | | |
gh release upload --clobber ${{ env.VERSION }} ${{ env.FILES }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
VERSION: ${{ steps.draft_release.outputs.tag_name }} | |
FILES: dist/version_*.tar.gz dist/version_*.zip dist/version_*_checksums.txt |