-
Notifications
You must be signed in to change notification settings - Fork 5
55 lines (49 loc) · 1.68 KB
/
goreleaser.yml
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
name: Build and release
on: push
jobs:
artifacts:
runs-on: ubuntu-latest
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Go
id: setup_go
uses: actions/setup-go@v2
with:
go-version: "1.15"
- name: Setup environment variables
id: setup_environment
shell: bash
run: |
echo "GOVERSION=$(go version)" >> $GITHUB_ENV
echo "GIT_BRANCH=$(git symbolic-ref --short HEAD 2>/dev/null || echo '')" >> $GITHUB_ENV
- name: Prepare compilation for linux/amd64 only
id: update_goreleaser_yml
if: github.ref == 'refs/heads/master'
shell: bash
run: |
sed -i -e "s/^ goos:.*# Dynamic\$/ goos: [ 'linux' ]/" .goreleaser.yml
sed -i -e "s/^ goarch:.*# Dynamic\$/ goarch: [ 'amd64' ]/" .goreleaser.yml
sed -i -e "s/^ goarm:.*# Dynamic\$/ goarm: []/" .goreleaser.yml
- name: Compile the source
id: compile
if: github.ref == 'refs/heads/master'
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: build --rm-dist --skip-validate
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Release a new version
id: compile_and_release
if: startsWith(github.ref, 'refs/tags/')
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist --parallelism 10
env:
HOMEBREW_TAP_GITHUB_TOKEN: '${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}