Skip to content

add github actions (#4) #6

add github actions (#4)

add github actions (#4) #6

Workflow file for this run

name: deployment
on:
push:
branches:
- 'main'
tags:
- "v*"
pull_request:
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.19
- name: Cache Go modules
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Generate changelog
if: startsWith(github.ref, 'refs/tags/v')
run: |
echo "GORELEASER_CURRENT_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
git fetch --unshallow
scripts/changelog | tee CHANGELOG.md
- name: Release
uses: goreleaser/goreleaser-action@v2
with:
version: latest
install-only: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [[ $GITHUB_REF == refs/tags/v* ]]; then
goreleaser release --release-notes=CHANGELOG.md
elif [[ $GITHUB_REF == refs/heads/trunk ]]; then
goreleaser --snapshot
fi
- name: Bump Homebrew formula
uses: mislav/bump-homebrew-formula-action@v1
if: "!contains(github.ref, '-') && startsWith(github.ref, 'refs/tags/v')" # skip prereleases and run on tags
with:
formula-name: glab
env:
COMMITTER_TOKEN: ${{ secrets.GITHUB_TOKEN }}