-
Notifications
You must be signed in to change notification settings - Fork 6
199 lines (191 loc) · 6.45 KB
/
frontends.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
name: Release naisdevice
on:
push:
branches:
- master
tags:
- "*"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
strategy:
fail-fast: false
matrix:
os: ["ubuntu-22.04", "macOS-latest"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- id: tool_versions
run: echo "go=$(grep golang .tool-versions | awk '{print $2}')" >> $GITHUB_OUTPUT
- uses: actions/setup-go@v5
with:
go-version: ${{ steps.tool_versions.outputs.go }}
- if: matrix.os == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install --yes build-essential
- run: "make test"
- run: "make check"
- run: "go vet ./..."
set-version:
runs-on: ubuntu-22.04
outputs:
version: ${{ steps.set-version.outputs.version }}
steps:
- uses: actions/checkout@v4
- name: set version
id: set-version
run: echo "version=${GITHUB_REF#refs/*/}" >> ${GITHUB_OUTPUT}
build-windows:
needs:
- set-version
runs-on: ubuntu-22.04
strategy:
matrix:
include:
- gotags: ""
output-suffix: ""
- gotags: "tenant"
output-suffix: "-tenant"
steps:
- uses: actions/checkout@v4
- id: tool_versions
run: echo "go=$(grep golang .tool-versions | awk '{print $2}')" >> $GITHUB_OUTPUT
- uses: actions/setup-go@v5
with:
go-version: ${{ steps.tool_versions.outputs.go }}
- name: build binaries and installer
env:
MSI_SIGN_CERT: "${{ secrets.MSI_SIGN_CERT }}"
MSI_SIGN_KEY: "${{ secrets.MSI_SIGN_KEY }}"
run: |
sudo apt-get update
sudo apt-get install --yes nsis osslsigncode
echo "${MSI_SIGN_CERT}" > packaging/windows/naisdevice.crt
echo "${MSI_SIGN_KEY}" > packaging/windows/naisdevice.key
make nsis GOTAGS=${{ matrix.gotags }} VERSION=${{ needs.set-version.outputs.version }}
mv packaging/windows/naisdevice.exe naisdevice${{ matrix.output-suffix }}.exe
- name: upload windows-installer
uses: actions/upload-artifact@v4
with:
name: installer-windows${{ matrix.output-suffix }}
path: naisdevice${{ matrix.output-suffix }}.exe
if-no-files-found: error
build-macos:
strategy:
matrix:
include:
- gotags: ""
output-suffix: ""
- gotags: "tenant"
output-suffix: "-tenant"
needs:
- set-version
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22.8" # Hard coded as 1.23 breaks wireguard
- name: Build wireguard
run: |
make wg
make wireguard-go
- id: tool_versions
run: echo "go=$(grep golang .tool-versions | awk '{print $2}')" >> $GITHUB_OUTPUT
- uses: actions/setup-go@v5
with:
go-version: ${{ steps.tool_versions.outputs.go }}
- name: Import Code-Signing Certificates
uses: Apple-Actions/import-codesign-certs@v3
with:
p12-file-base64: ${{ secrets.CERTIFICATES_P12 }}
p12-password: ${{ secrets.CERTIFICATES_P12_PASSWORD }}
- name: build pkg
env:
APPLE_NOTARIZE_AUTH_KEY_P8_BASE64: "${{ secrets.APPLE_NOTARIZE_AUTH_KEY_P8_BASE64 }}"
APPLE_NOTARIZE_D: "${{ secrets.APPLE_NOTARIZE_D }}"
APPLE_NOTARIZE_I: "${{ secrets.APPLE_NOTARIZE_I }}"
run: |
brew install imagemagick || brew link --overwrite [email protected]
make pkg GOTAGS=${{ matrix.gotags }} VERSION=${{ needs.set-version.outputs.version }} RELEASE=${{ startsWith(github.ref, 'refs/tags/') && 'true' || 'false' }}
if [[ -n "${{ matrix.output-suffix }}" ]]; then
mv naisdevice.pkg naisdevice${{ matrix.output-suffix }}.pkg
fi
- name: upload pkg
uses: actions/upload-artifact@v4
with:
name: installer-macos${{ matrix.output-suffix }}
path: naisdevice${{ matrix.output-suffix }}.pkg
if-no-files-found: error
build-linux:
strategy:
matrix:
include:
- gotags: ""
output-suffix: ""
- gotags: "tenant"
output-suffix: "-tenant"
needs:
- set-version
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- id: tool_versions
run: echo "go=$(grep golang .tool-versions | awk '{print $2}')" >> $GITHUB_OUTPUT
- uses: actions/setup-go@v5
with:
go-version: ${{ steps.tool_versions.outputs.go }}
- name: create debian package
env:
SUFFIX: "${{ matrix.output-suffix }}"
run: |
sudo apt-get update
sudo apt-get install --yes build-essential ruby ruby-dev rubygems
sudo gem install --no-document fpm -v 1.15.1
make deb GOTAGS=${{ matrix.gotags }} VERSION=${{ needs.set-version.outputs.version }}
mv naisdevice*.deb "naisdevice${{ matrix.output-suffix }}.deb"
- name: upload debian package
uses: actions/upload-artifact@v4
with:
name: installer-linux${{ matrix.output-suffix }}
path: naisdevice${{ matrix.output-suffix }}.deb
if-no-files-found: error
release:
permissions:
contents: write
needs:
- set-version
- test
- build-macos
- build-windows
- build-linux
runs-on: ubuntu-22.04
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: download artifacts
id: download-artifacts
uses: actions/download-artifact@v4
- name: sha256 sums
run: |
for file in ${{ steps.download-artifacts.outputs.download-path }}/*/*; do
sha256sum "$file" | awk {'print $1}' > "$file.sha256"
done
- name: print artifacts
run: ls -R ${{ steps.download-artifacts.outputs.download-path }}
- name: create release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
name: Release ${{ needs.set-version.outputs.version }}
tag_name: ${{ needs.set-version.outputs.version }}
draft: false
prerelease: false
generate_release_notes: true
files: |
${{ steps.download-artifacts.outputs.download-path }}/*/*