-
Notifications
You must be signed in to change notification settings - Fork 2
60 lines (52 loc) · 1.57 KB
/
Copy pathdeploy.yml
File metadata and controls
60 lines (52 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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: Test Release
uses: goreleaser/goreleaser-action@v4
if: "!startsWith(github.ref, 'refs/head/v')"
with:
version: latest
args: release --snapshot
- name: Release
uses: goreleaser/goreleaser-action@v4
if: startsWith(github.ref, 'refs/tags/v')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
version: latest
args: release --clean --release-notes=CHANGELOG.md
- 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 }}