-
Notifications
You must be signed in to change notification settings - Fork 9
85 lines (81 loc) · 2.31 KB
/
release.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: Build and Release Binaries
on: [push]
permissions:
contents: write
jobs:
build:
name: 'Build Assets'
runs-on: ubuntu-latest
strategy:
matrix:
build: [linux_amd64, windows_amd64, darwin_amd64, darwin_arm64]
include:
- build: linux_amd64
goos: linux
goarch: amd64
ext: ''
- build: windows_amd64
goos: windows
goarch: amd64
ext: '.exe'
- build: darwin_amd64
goos: darwin
goarch: amd64
ext: ''
- build: darwin_arm64
goos: darwin
goarch: arm64
ext: ''
steps:
- uses: actions/checkout@v4
with:
# We need all tags
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.20"
check-latest: true
- name: Build
run: |
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} ./scripts/build_generator
mv main${{ matrix.ext }} autometrics${{ matrix.ext }}
- name: Pack (Zip)
run: |
zip autometrics-${{ matrix.build }}.zip -v -z autometrics${{ matrix.ext }}
- name: Upload (Zip)
uses: actions/upload-artifact@v3
with:
name: autometrics ${{ matrix.build }}
path: autometrics-${{ matrix.build }}.zip
if-no-files-found: error
retention-days: 7
add_assets:
name: 'Add Assets'
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Fetch Linux (AMD64) build
uses: actions/download-artifact@v3
with:
name: autometrics linux_amd64
- name: Fetch Windows (AMD64) build
uses: actions/download-artifact@v3
with:
name: autometrics windows_amd64
- name: Fetch Darwin (AMD64) build
uses: actions/download-artifact@v3
with:
name: autometrics darwin_amd64
- name: Fetch Darwin (ARM64) build
uses: actions/download-artifact@v3
with:
name: autometrics darwin_arm64
- name: Release with Notes
uses: softprops/action-gh-release@v1
with:
files: |
*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}