-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (43 loc) · 1.31 KB
/
release.yaml
File metadata and controls
50 lines (43 loc) · 1.31 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
name: Publish New Release
on:
release:
types: [created]
jobs:
releases-matrix:
name: Release Go Binary
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux, windows, darwin]
goarch: [amd64]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '^1.17'
- name: make dist
run: mkdir dist
- name: build
run: go build -ldflags "-s -w" -o dist ./...
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
- name: additional items
run: cp README.md dist/
- name: Zip Folder
if: ${{ matrix.goos == 'windows'}}
run: zip -r ../release.zip ./
working-directory: dist
- name: Tar Folder
if: ${{ matrix.goos != 'windows'}}
run: tar czf ../release.tgz ./
working-directory: dist
- name: Upload release assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_name: commands-${{ matrix.goos }}-${{ matrix.goarch }}.${{ matrix.goos == 'windows' && 'zip' || 'tgz' }}
asset_path: ${{ matrix.goos == 'windows' && 'release.zip' || 'release.tgz' }}
asset_content_type: application/octet-stream