-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (52 loc) · 1.55 KB
/
go.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
56
57
58
59
60
61
name: Go Release Builder
on:
workflow_dispatch:
release:
types: [created]
jobs:
build:
name: Build Go
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux]
goarch: [amd64, arm64]
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.20.5 # use the Go version of your choice
- name: Build
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
go build -v -o dotfiles-${{ matrix.goos }}-${{ matrix.goarch }} . # build and name output file
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
name: dotfiles-${{ matrix.goos }}-${{ matrix.goarch }}
path: ./dotfiles-${{ matrix.goos }}-${{ matrix.goarch }} # use the path to your built binary
upload:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
matrix:
goos: [linux]
goarch: [amd64, arm64]
steps:
- name: Download a build artifact
uses: actions/download-artifact@v3
with:
name: dotfiles-${{ matrix.goos }}-${{ matrix.goarch }}
- name: Upload Release Asset
if: github.event_name == 'release' # Only run if this workflow was triggered by a release
uses: softprops/action-gh-release@v1
with:
files: ./dotfiles-${{ matrix.goos }}-${{ matrix.goarch }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}