Skip to content

Add goreleaser github action. Fix some issues. #1

Add goreleaser github action. Fix some issues.

Add goreleaser github action. Fix some issues. #1

Workflow file for this run

name: Release
on:
push:
branches:
- main
jobs:
release:
name: Release with GoReleaser
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.22.3'
- name: Install GoReleaser
run: |
curl -sSfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sh
- name: Calculate next minor version
id: next-version
run: |
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
major=$(echo $latest_tag | cut -d'.' -f1)
minor=$(echo $latest_tag | cut -d'.' -f2)
new_minor=$((minor + 1))
echo "next_version=${major}.${new_minor}.0" >> $GITHUB_ENV
- name: Create tag
run: |
git config user.name "github-actions"
git config user.email "github-actions@github.com"
git tag ${{ env.next_version }}
git push origin ${{ env.next_version }}
- name: Run GoReleaser
run: goreleaser release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}