Skip to content
This repository was archived by the owner on Apr 18, 2024. It is now read-only.

Commit fe72d8e

Browse files
juliangruberbajtos
andauthored
Add sign and notarize macOS x86_64 #35 (#53)
* sign and notarize (wip) * always run for now * add install gon * try fixing the rate limiting issue * just always run on macos * change gon invocation * try again after updating env * try again after updating env * try again after updating env * try again after updating env * pass secrets to env * import cert into keychain * just pass the cert name (no secret) * fix build id * fix build id * build on all darwin architectures * add sign arm64 * fix hcl syntax * undo debug changes * clean up * attach artifacts to workflow run * run on push again * clean up * update bundle id * use hooks instead of signs * turn gon config into dotfile * add zip output * try "signs" again * try mirroring mitchellh/gon setup * update paths * 🤔 * looks like username needs to be hardcoded * clean up * attach everything from `./dist` * remove unnecessary dmg artifact * undo some changes * only archive macos * undo some changes * undo some changes * undo some changes * zip -> tar.gz * add arch to macos artifact * remove version from other builds too * skip folder artifact upload * Revert "zip -> tar.gz" This reverts commit c49d051. * docs * keep previous artifact naming * fix artifact name * build all darwin archs * sign macos archs independently * refactor, fix redundant signs ids * consistent naming * fix signing source paths * fix source path again * arm signing issues * clean up * always run * try manual arm script * fix path * fix paths * wait, why is x86_64 failing now * fix sign command * switch back to gon, remove arm signing attempts again * Update bundle_id Co-authored-by: Miroslav Bajtoš <saturn@bajtos.net> Co-authored-by: Miroslav Bajtoš <saturn@bajtos.net>
1 parent d260b63 commit fe72d8e

File tree

3 files changed

+82
-10
lines changed

3 files changed

+82
-10
lines changed

.github/workflows/release.yml

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ name: goreleaser
22

33
on:
44
push:
5-
# run only against tags
6-
tags:
7-
- '*'
85

96
permissions:
107
contents: write
@@ -13,7 +10,7 @@ permissions:
1310

1411
jobs:
1512
goreleaser:
16-
runs-on: ubuntu-latest
13+
runs-on: macos-latest
1714
steps:
1815
-
1916
name: Checkout
@@ -29,6 +26,7 @@ jobs:
2926
tag: v0.0.19
3027
fileName: saturn-webui.tar.gz
3128
out-file-path: resources/webui
29+
token: ${{ secrets.GITHUB_TOKEN }}
3230
-
3331
name: Unpack web UI archive
3432
run: |
@@ -43,6 +41,33 @@ jobs:
4341
uses: actions/setup-go@v2
4442
with:
4543
go-version: 1.18
44+
-
45+
name: Install gon
46+
run: |
47+
brew tap mitchellh/gon
48+
brew install mitchellh/gon/gon
49+
-
50+
name: Install the Apple certificate and provisioning profile
51+
env:
52+
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
53+
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
54+
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
55+
run: |
56+
# create variables
57+
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
58+
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
59+
60+
# import certificate and provisioning profile from secrets
61+
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode --output $CERTIFICATE_PATH
62+
63+
# create temporary keychain
64+
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
65+
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
66+
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
67+
68+
# import certificate to keychain
69+
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
70+
security list-keychain -d user -s $KEYCHAIN_PATH
4671
-
4772
name: Run GoReleaser
4873
uses: goreleaser/goreleaser-action@v2
@@ -53,5 +78,13 @@ jobs:
5378
args: release --rm-dist
5479
env:
5580
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81+
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
5682
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution
5783
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
84+
-
85+
name: Attach produced packages to Github Action
86+
uses: actions/upload-artifact@v2
87+
with:
88+
name: dist
89+
path: dist/*.*
90+
if-no-files-found: error

.gon.hcl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
source = ["./dist/macos-x86-64_darwin_amd64_v1/L2-node"]
2+
bundle_id = "io.filecoin.saturn.l2-node"
3+
4+
apple_id {
5+
username = "oli@protocol.ai"
6+
password = "@env:AC_PASSWORD"
7+
}
8+
9+
sign {
10+
application_identity = "Developer ID Application: Protocol Labs, Inc."
11+
}
12+
13+
zip {
14+
output_path="./dist/L2-node_Darwin_x86_64.zip"
15+
}

.goreleaser.yaml

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,52 @@ before:
77
# you may remove this if you don't need go generate
88
- go generate ./...
99
builds:
10-
- env:
10+
- id: saturn
11+
env:
1112
- CGO_ENABLED=0
1213
goos:
1314
- linux
1415
- windows
15-
- darwin
1616
ignore:
1717
- goos: windows
1818
goarch: arm64
1919
main: ./cmd/saturn-l2
2020
binary: saturn-L2-node
21-
21+
- id: macos-x86-64
22+
env:
23+
- CGO_ENABLED=0
24+
goos:
25+
- darwin
26+
goarch:
27+
- amd64
28+
main: ./cmd/saturn-l2
2229
archives:
23-
- replacements:
24-
darwin: Darwin
30+
- builds:
31+
- saturn
32+
name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
33+
replacements:
2534
linux: Linux
2635
windows: Windows
2736
386: i386
2837
amd64: x86_64
38+
- builds:
39+
- macos-x86-64
40+
id: macos-x86-64-zip
41+
format: zip
42+
name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
43+
replacements:
44+
darwin: Darwin
45+
amd64: x86_64
2946
checksum:
3047
name_template: 'checksums.txt'
48+
signs:
49+
- id: macos-x86-64
50+
ids:
51+
- macos-x86-64-zip
52+
cmd: gon
53+
args:
54+
- .gon.hcl
55+
artifacts: all
3156
snapshot:
3257
name_template: "{{ incpatch .Version }}-next"
3358
changelog:
@@ -45,4 +70,3 @@ changelog:
4570
exclude:
4671
- '^docs:'
4772
- '^test:'
48-

0 commit comments

Comments
 (0)