Skip to content

Troubleshoot Github Actions for goreleaser. #4

Troubleshoot Github Actions for goreleaser.

Troubleshoot Github Actions for goreleaser. #4

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
with:
fetch-depth: 0 # Fetch all history for all branches and tags
- 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` 2>/dev/null || echo "v0.0.0")
major=$(echo $latest_tag | cut -d'.' -f1 | tr -d 'v')
minor=$(echo $latest_tag | cut -d'.' -f2)
new_minor=$((minor + 1))
next_version="v${major}.${new_minor}.0"
echo "next_version=${next_version}" >> $GITHUB_ENV
- name: Create tag
env:
PAT: ${{ secrets.PAT }}
run: |
git config user.name "github-actions"
git config user.email "github-actions@github.com"
git tag ${{ env.next_version }}
git push https://github-actions:${{ secrets.PAT }}@github.com/marianogappa/truco.git ${{ env.next_version }}
- name: Run GoReleaser
run: goreleaser release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}