-
Notifications
You must be signed in to change notification settings - Fork 60
107 lines (86 loc) · 2.76 KB
/
build-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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# NOTE: multiple `make` commands could be replaced with
# `make release` in future if all binaries are built on MacOS machine
name: Release Binaries
on:
# Workflow executes when a new release is created
release:
types: [created]
env:
GO_VERSION: '1.22.5'
jobs:
# most binaries can be built on linux machine which is the most cost-efficient on GitHub actions
# for building darwin-arm64 binary we need Xcode, therefore, we need to build it on MacOS
linux-build:
name: Build binaries on Ubuntu
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '${{ env.GO_VERSION }}'
- name: Run Makefile
run: |
make package
make linux
make linux-arm64
make windows
make windows32
# Artifacts docs: https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts
- name: Upload files as artifact
uses: actions/upload-artifact@v4
with:
name: ubuntu-build-files
path: dist/aws-sso*
retention-days: 1
macos-build:
name: Build binaries on MacOS
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '${{ env.GO_VERSION }}'
- name: Run Makefile
run: |
make darwin-arm64
make darwin
- name: Upload files as artifact
uses: actions/upload-artifact@v4
with:
name: macos-build-files
path: dist/aws-sso*
retention-days: 1
sign-and-upload-files:
name: Sign and upload binary files
runs-on: ubuntu-latest
# Wait for binary files to be built
needs: [linux-build, macos-build]
steps:
- name: Download ubuntu binaries
uses: actions/download-artifact@v4
with:
name: ubuntu-build-files
path: dist/
- name: Download macos binaries
uses: actions/download-artifact@v4
with:
name: macos-build-files
path: dist/
# Source: https://github.com/crazy-max/ghaction-import-gpg
- name: Import GPG key
uses: crazy-max/[email protected]
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Create signature file
run: |
shasum -a 256 dist/* | gpg --clear-sign > dist/release.sig.asc
# Source: https://github.com/svenstaro/upload-release-action
- name: Upload all files to release
uses: svenstaro/upload-release-action@v2
with:
file: dist/*
overwrite: true
file_glob: true