-
Notifications
You must be signed in to change notification settings - Fork 0
161 lines (142 loc) · 5.57 KB
/
build.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
name: "create-prod-build"
on:
workflow_dispatch:
jobs:
package:
strategy:
matrix:
platform: [ windows-latest, macos-latest, ubuntu-latest ]
go-version: [1.18]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- name: get version
run: echo "PACKAGE_VERSION=$(node -p "require('./frontend/package.json').version")" >> $GITHUB_ENV
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Import Code-Signing Certificates for macOS
if: matrix.platform == 'macos-latest'
uses: Apple-Actions/import-codesign-certs@v1
with:
# The certificates in a PKCS12 file encoded as a base64 string
p12-file-base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }}
# The password used to import the PKCS12 file.
p12-password: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }}
- name: setup node
uses: actions/setup-node@v2
with:
node-version: 14
- name: build frontend
env:
REACT_APP_NETCTRL_REMOTE_URL: "https://netctrl.io"
run: |
cd frontend
yarn
yarn build
- name: Get Wails
run: go install github.com/wailsapp/wails/v2/cmd/wails@latest
- name: MacOS download gon for code signing and app notarization
if: matrix.platform == 'macos-latest'
run: |
brew install mitchellh/gon/gon
- name: Build and Sign MacOS Binaries
if: matrix.platform == 'macos-latest'
env:
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
run: |
chmod +x ./build-macos.sh
./build-macos.sh
- name: Build and package for Linux
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install libwebkit2gtk-4.0-dev libgtk-3-dev libpcap-dev -y
wails build -platform linux/amd64 -ldflags "-s -w"
tar -zcvf monitor-deb-amd64.tar.gz build/bin/Monitor
- name: Build package windows
if: matrix.platform == 'windows-latest'
run: |
$GP = (go env GOPATH)
$env:path = "$env:path;$GP\bin"
echo "building on ${{ matrix.os }}"
choco install mingw
choco install nsis
wails build -platform windows/amd64 -clean -nsis -ldflags "-s -w"
- name: Sign Windows binaries
if: matrix.platform == 'windows-latest'
run: |
echo "Creating certificate file"
New-Item -ItemType directory -Path certificate
Set-Content -Path certificate\certificate.txt -Value '${{ secrets.WIN_SIGNING_CERT }}'
certutil -decode certificate\certificate.txt certificate\certificate.pfx
echo "Signing Monitor and Monitor Installer"
& 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe' sign /fd sha256 /tr http://ts.ssl.com /f certificate\certificate.pfx /p '${{ secrets.WIN_SIGNING_CERT_PASSWORD }}' .\build\bin\Monitor.exe
& 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe' sign /fd sha256 /tr http://ts.ssl.com /f certificate\certificate.pfx /p '${{ secrets.WIN_SIGNING_CERT_PASSWORD }}' .\build\bin\Monitor-amd64-installer.exe
- name: upload artifacts macOS
if: matrix.platform == 'macos-latest'
uses: actions/upload-artifact@v2
with:
name: monitor-macos
path: monitor-*.zip
- name: upload artifact windows
if: matrix.platform == 'windows-latest'
uses: actions/upload-artifact@v2
with:
name: monitor-windows
path: .\build\bin\*.exe
- name: upload artifact ubuntu
if: matrix.platform == 'ubuntu-latest'
uses: actions/upload-artifact@v2
with:
name: monitor-ubuntu
path: monitor-deb-amd64.tar.gz
release:
runs-on: ubuntu-latest
needs: package
steps:
- name: Download Windows artifacts
uses: actions/download-artifact@v2
with:
name: monitor-windows
- name: Download macOS artifacts
uses: actions/download-artifact@v2
with:
name: monitor-macos
- name: Download ubuntu artifacts
uses: actions/download-artifact@v2
with:
name: monitor-ubuntu
- name: Unzip and move files for DO spaces
run: |
mkdir -p bin/darwin/amd64
mkdir -p bin/darwin/arm64
mkdir -p bin/windows/amd64
mkdir -p bin/linux/amd64
echo "Directory contents:"
ls
cp ./monitor-darwin-amd64.zip bin/darwin/amd64
cp ./monitor-darwin-arm64.zip bin/darwin/arm64
cp ./*.exe bin/windows/amd64
cp monitor-deb-amd64.tar.gz bin/linux/amd64
# unzip ./monitor-darwin-amd64.zip -d bin/darwin/amd64
# unzip ./monitor-darwin-arm64.zip -d bin/darwin/arm64
# - name: Create GitHub release
# uses: softprops/action-gh-release@v1
# with:
# name: Monitor prod build v${{ env.PACKAGE_VERSION }}
# tag_name: prod-${{ env.PACKAGE_VERSION }}
# files: |
# Monitor-*.exe
# monitor-*.zip
# monitor-*.tar.gz
- name: Upload to DO spaces
uses: BetaHuhn/do-spaces-action@v2
with:
access_key: ${{ secrets.DO_ACCESS_KEY}}
secret_key: ${{ secrets.DO_SECRET_KEY }}
space_name: ${{ secrets.DO_SPACE_NAME }}
space_region: ${{ secrets.DO_SPACE_REGION }}
source: bin
out_dir: monitor/prod/