Skip to content

Commit

Permalink
Troubleshoot goreleaser configs.
Browse files Browse the repository at this point in the history
  • Loading branch information
marianogappa committed Jun 23, 2024
1 parent 5f2c674 commit 23c036b
Showing 1 changed file with 37 additions and 23 deletions.
60 changes: 37 additions & 23 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,48 @@
name: goreleaser
name: Release

on:
pull_request:
push:

permissions:
contents: write
branches:
- main

jobs:
goreleaser:
release:
name: Release with GoReleaser
runs-on: ubuntu-latest

steps:
-
name: Checkout
uses: actions/checkout@v4
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v5
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
fetch-depth: 0 # Fetch all history for all branches and tags

- name: Set up Go
uses: actions/setup-go@v3
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
# 'latest', 'nightly', or a semver
version: 'latest'
args: release --clean
go-version: '1.18' # Use the desired Go version

- 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
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 }}
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}

0 comments on commit 23c036b

Please sign in to comment.