Skip to content

Commit 3196c74

Browse files
HaiberLjoaopalet
andauthored
Setup Notarization Pipeline (#54)
* setup KeyChain * setup Notarization * Remove custom name template in archives for consistency and skip snap publishing --------- Co-authored-by: João Palet <joao.palet@outlook.com>
1 parent 4897784 commit 3196c74

File tree

2 files changed

+39
-9
lines changed

2 files changed

+39
-9
lines changed

.github/workflows/release.yaml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ permissions:
1616

1717
jobs:
1818
goreleaser:
19-
runs-on: ubuntu-latest
19+
runs-on: macOS-latest
2020
env:
2121
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }}
2222
steps:
@@ -34,6 +34,24 @@ jobs:
3434
with:
3535
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
3636
passphrase: ${{ secrets.GPG_PASSPHRASE }}
37+
- name: Set up keychain
38+
run: |
39+
echo -n $SIGNING_CERTIFICATE_BASE64 | base64 -d -o ./ApplicationID.p12
40+
KEYCHAIN_PATH=$RUNNER_TEMP/ios_signing_temp.keychain-db
41+
security create-keychain -p "${{ secrets.TEMP_KEYCHAIN }}" $KEYCHAIN_PATH
42+
security default-keychain -s $KEYCHAIN_PATH
43+
security unlock-keychain -p "${{ secrets.TEMP_KEYCHAIN }}" $KEYCHAIN_PATH
44+
security import ./ApplicationID.p12 -P "${{ secrets.APPLICATION_ID }}" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
45+
security list-keychain -d user -s $KEYCHAIN_PATH
46+
echo -n $AUTHKEY_BASE64 | base64 -d -o ./AuthKey.p8
47+
xcrun notarytool store-credentials stackit-cli -i $APPLE_ISSUER -d $APPLE_KEY_ID -k AuthKey.p8 --keychain $KEYCHAIN_PATH
48+
rm ./ApplicationID.p12
49+
rm ./AuthKey.p8
50+
env:
51+
APPLE_ISSUER: ${{ secrets.APPLE_ISSUER }}
52+
APPLE_KEY_ID: ${{ secrets.APPLE_KEY_ID }}
53+
SIGNING_CERTIFICATE_BASE64: ${{ secrets.APPLICATION_ID_CERT }}
54+
AUTHKEY_BASE64: ${{ secrets.APPLE_API_KEY }}
3755
- name: Install Snapcraft
3856
uses: samuelmeuli/action-snapcraft@v2
3957
- name: Run GoReleaser

.goreleaser.yaml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,30 @@ builds:
2020
- id: macos-builds
2121
env:
2222
- CGO_ENABLED=0
23+
- BUNDLE_ID=cloud.stackit.cli
24+
- 'APPLE_APPLICATION_IDENTITY=Developer ID Application: Schwarz IT KG'
2325
goos:
2426
- darwin
2527
binary: "stackit"
28+
goarch:
29+
- arm64
30+
- amd64
31+
hooks:
32+
post:
33+
- |
34+
sh -c '
35+
codesign -s "{{.Env.APPLE_APPLICATION_IDENTITY}}" -f -v --options=runtime "dist/macos-builds_{{.Target}}/{{.Name}}"
36+
codesign -vvv --deep --strict "dist/macos-builds_{{.Target}}/{{.Name}}"
37+
ls -l "dist/macos_{{.Target}}"
38+
hdiutil create -volname "STACKIT-CLI" -srcfolder "dist/macos-builds_{{.Target}}/{{.Name}}" -ov -format UDZO "dist/{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}.dmg"
39+
codesign -s "{{.Env.APPLE_APPLICATION_IDENTITY}}" -f -v --options=runtime "dist/{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}.dmg"
40+
xcrun notarytool submit --keychain-profile "stackit-cli" --wait --progress dist/{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}.dmg
41+
xcrun stapler staple "dist/{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}.dmg"
42+
spctl -a -t open --context context:primary-signature -v dist/{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}.dmg
43+
'
2644
2745
archives:
2846
- format: tar.gz
29-
# This name template makes the OS and Arch compatible with the results of `uname`
30-
name_template: >-
31-
{{ .ProjectName }}_
32-
{{- title .Os }}_
33-
{{- if eq .Arch "amd64" }}x86_64
34-
{{- else if eq .Arch "386" }}i386
35-
{{- else }}{{ .Arch }}{{ end }}
36-
{{- if .Arm }}v{{ .Arm }}{{ end }}
3747
format_overrides:
3848
- goos: windows
3949
format: zip
@@ -95,3 +105,5 @@ snapcrafts:
95105
license: Apache-2.0
96106
# Will only publish to `edge` and `beta` channels
97107
grade: devel
108+
# Skip publishing until we get approval for used interfaces or classic confinement
109+
publish: false

0 commit comments

Comments
 (0)