Add goreleaser and CLI publish workflow #2
Workflow file for this run
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: Publish Release CLI | |
on: | |
push: | |
tags: | |
- cli/v* | |
release: | |
types: | |
- published | |
permissions: | |
contents: write | |
jobs: | |
goreleaser: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
- name: Set VERSION | |
run: | | |
TAG="${{ github.event.inputs.version || github.ref_name }}" | |
# Get rid of the tag since the cli/ prefix confuses goreleaser. | |
git tag -d $TAG | |
echo "VERSION=${TAG#cli/v}" >> $GITHUB_ENV | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v6 | |
with: | |
distribution: goreleaser | |
version: '~> v2' | |
args: release --clean --snapshot --verbose | |
env: | |
VERSION: ${{ github.event.ref }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload assets | |
uses: actions/upload-artifact@v3 | |
with: | |
name: release | |
path: dist/* |