@@ -10,15 +10,15 @@ jobs:
10
10
runs-on : ubuntu-latest
11
11
steps :
12
12
- name : ' wait for tests'
13
-
13
+
14
14
with :
15
15
ref : ${{ github.ref }}
16
16
check-name : ' go test & build'
17
17
repo-token : ${{ secrets.GITHUB_TOKEN }}
18
18
wait-interval : 10
19
19
20
- linux-windows :
21
- name : ' build linux and windows binaries'
20
+ build-all :
21
+ name : ' build all binaries'
22
22
runs-on : ubuntu-latest
23
23
needs :
24
24
- test
@@ -29,12 +29,14 @@ jobs:
29
29
VERSION_PACKAGE : ' github.com/coupergateway/couper/utils'
30
30
strategy :
31
31
matrix :
32
- goos : [linux, windows]
32
+ goos : [linux, darwin, windows]
33
33
goarch : [amd64, arm64]
34
34
fail-fast : false
35
35
outputs :
36
36
linux_amd64 : ${{ steps.build.outputs.linux_amd64 }}
37
37
linux_arm64 : ${{ steps.build.outputs.linux_arm64 }}
38
+ darwin_amd64 : ${{ steps.build.outputs.darwin_amd64 }}
39
+ darwin_arm64 : ${{ steps.build.outputs.darwin_arm64 }}
38
40
windows_amd64 : ${{ steps.build.outputs.windows_amd64 }}
39
41
windows_arm64 : ${{ steps.build.outputs.windows_arm64 }}
40
42
steps :
46
48
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
47
49
echo "::set-output name=build_date::$(date +'%F')"
48
50
49
- - uses : wangyoucao577/go-release-action@v1.40
51
+ - uses : wangyoucao577/go-release-action@v1.51
50
52
id : build
51
53
with :
52
54
github_token : ${{ secrets.GITHUB_TOKEN }}
@@ -62,11 +64,22 @@ jobs:
62
64
overwrite : true
63
65
post_command : |
64
66
echo "::set-output name=${{ matrix.goos }}_${{ matrix.goarch }}::$SHA256_SUM"
67
+ - name : Archive macOS builds
68
+ if : ${{ matrix.goos == 'darwin' }}
69
+ uses : actions/upload-artifact@v4
70
+ with :
71
+ name : macos-${{ matrix.goarch }}
72
+ path : couper-${{ github.ref_name }}-darwin-${{ matrix.goarch }}.tar.gz
73
+ retention-days : 1
74
+ compression-level : 0
75
+ if-no-files-found : error
76
+
65
77
macos :
66
- name : ' build and sign MacOS binary'
67
- runs-on : macos-11
78
+ name : ' sign MacOS binary'
79
+ runs-on : ubuntu-latest
68
80
needs :
69
81
- test
82
+ - build-all
70
83
strategy :
71
84
matrix :
72
85
goarch : [amd64, arm64]
@@ -75,85 +88,64 @@ jobs:
75
88
contents : write
76
89
packages : write
77
90
env :
78
- AC_PASSWORD : ${{ secrets.MACOS_DEVELOPER_APPLICATION_PWD }}
79
91
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
80
- VERSION_PACKAGE : ' github.com/coupergateway/couper/utils'
81
92
outputs :
82
93
amd64 : ${{ steps.upload.outputs.amd64 }}
83
94
arm64 : ${{ steps.upload.outputs.arm64 }}
84
- steps :
85
- - uses : actions/checkout@v4
86
-
87
- - name : ' setup go'
95
+ steps : # Write Apple Store Connect Key & cert to file
96
+ - name : ' setup distribution keys'
97
+ env :
98
+ STORE_CONNECT_KEY : ${{ secrets.APPLE_APP_STORE_CONNECT_KEY_JSON }}
99
+ P12_CERT_BASE64 : ${{ secrets.APPLE_DIST_CERT_P12_FILE_BASE64 }}
100
+ run : |
101
+ echo $STORE_CONNECT_KEY > app_store_key.json
102
+ echo -n "$P12_CERT_BASE64" | base64 --decode > cert.p12
103
+ - name : ' download artifacts'
104
+ uses : actions/download-artifact@v4
105
+ with :
106
+ name : macos-${{ matrix.goarch }}
107
+ - name : ' extract artifacts'
108
+ run : |
109
+ tar -xzf couper-${{ github.ref_name }}-darwin-${{ matrix.goarch }}.tar.gz
110
+ - name : Sign
111
+ uses : indygreg/apple-code-sign-action@v1
112
+ with :
113
+ p12_file : cert.p12
114
+ p12_password : ' ${{ secrets.APPLE_DIST_CERT_P12_PASSWORD }}'
115
+ sign : true
116
+ sign_args : |
117
+ --code-signature-flags
118
+ runtime
119
+ input_path : couper
120
+ - name : ' Archive signed macOS binary'
121
+ uses : montudor/action-zip@v1
122
+ with :
123
+ args : zip -qq couper-${{ github.ref_name }}-macos-${{ matrix.goarch }}.zip couper
124
+ - name : Notarize
125
+ uses : indygreg/apple-code-sign-action@v1
126
+ with :
127
+ app_store_connect_api_key_json_file : app_store_key.json
128
+ sign : false
129
+ notarize : true
130
+ staple : false # we can't staple mach-o binaries; gatekeeper will check it: `spctl -a -vvv -t install couper`
131
+ input_path : ${{ github.workspace }}/couper-${{ github.ref_name }}-macos-${{ matrix.goarch }}.zip
132
+ - name : Set up Go 1.x
88
133
89
134
with :
90
135
go-version : ' 1.22'
91
-
92
- - name : Set GOARCH environment variable
93
- run : echo "GOARCH=${{ matrix.goarch }}" >> $GITHUB_ENV
94
-
95
- - name : ' import certificate'
96
- env :
97
- BUILD_CERTIFICATE_BASE64 : ${{ secrets.MACOS_CERTIFICATE_BASE64 }}
98
- P12_PASSWORD : ${{ secrets.MACOS_CERTIFICATE_PWD }}
99
- KEYCHAIN_PASSWORD : ${{ secrets.MACOS_KEYCHAIN_PWD }}
100
- run : |
101
- # create variables
102
- CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
103
- KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
104
-
105
- # import certificate and provisioning profile from secrets
106
- echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
107
-
108
- # create temporary keychain
109
- security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
110
- security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
111
- security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
112
-
113
- # import certificate to keychain
114
- security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
115
- security list-keychain -d user -s $KEYCHAIN_PATH
116
- - name : ' install gon'
117
- run :
go install github.com/mitchellh/gon/[email protected]
118
136
- name : ' install assets-uploader'
119
- run :
go install github.com/wangyoucao577/assets-uploader/[email protected]
120
- - name : ' build Couper'
121
- run : |
122
- go build -ldflags "-X ${VERSION_PACKAGE}.VersionName=`git describe --tags --abbrev=0 --exact-match || git symbolic-ref -q --short HEAD` -X ${VERSION_PACKAGE}.BuildName=`git rev-parse --short HEAD` -X ${VERSION_PACKAGE}.BuildDate=`date +'%F'`" -v -o ./.macos/Couper.app/Contents/couper main.go
123
- - name : ' cleanup finder attributes'
124
- run : |
125
- xattr -c ./.macos/Couper.app/Contents/Info.plist
126
- xattr -c ./.macos/Entitlements.plist
127
- plutil -convert xml1 .macos/Entitlements.plist && plutil -lint .macos/Entitlements.plist
128
- - name : ' verify identity'
129
- run : security find-identity -v
130
- - name : ' sign Couper binary'
131
- run : codesign -i "binary.com.xxx.couper" -s "4B8FA10CCB8F16F9F464385768D82645831F4644" -f -v --timestamp --options runtime ./.macos/Couper.app/Contents/couper
132
- - name : ' create signed binary archive' # keep utf8 things with ditto
133
- run : ditto -c -k --sequesterRsrc ./.macos/Couper.app/Contents/couper ./.macos/couper.zip
134
- # - name: 'create macOS dmg with signed binary'
135
- # run: |
136
- # mkdir -p ./.macos/Couper.app/Contents/MacOS
137
- # mv ./.macos/Couper.app/Contents/couper ./.macos/Couper.app/Contents/MacOS/couper
138
- # codesign -s "4B8FA10CCB8F16F9F464385768D82645831F4644" -f -v --timestamp --options runtime --entitlements ./.macos/Entitlements.plist ./.macos/Couper.app/Contents/MacOS/couper
139
- # cd .macos && go run make.go && cd ..
140
- - name : ' notarize' # and stable'
141
- run : gon -log-level=info -log-json ./.gon.hcl
142
- # - name: 'verify image notarization'
143
- # run: spctl --assess --type open --context context:primary-signature -v ./.macos/couper.dmg
144
- - name : ' upload archive'
137
+ run :
go install github.com/wangyoucao577/assets-uploader/[email protected]
138
+ - name : ' upload signed binary archive'
145
139
id : ' upload'
146
140
run : |
147
- mv ./.macos/couper.zip ./couper-$GITHUB_REF_NAME-macos-${{ matrix.goarch }}.zip && github-assets-uploader -f ./couper-$GITHUB_REF_NAME-macos-${{ matrix.goarch }}.zip -overwrite -repo coupergateway/couper -releasename $GITHUB_REF_NAME -token $GITHUB_TOKEN
148
- shasum -a 256 ./couper-$GITHUB_REF_NAME-macos-${{ matrix.goarch }}.zip | cut -d ' ' -f1 > ./couper-$GITHUB_REF_NAME-macos-${{ matrix.goarch }}.zip.sha256 && github-assets-uploader -f ./couper-$GITHUB_REF_NAME-macos-${{ matrix.goarch }}.zip.sha256 -overwrite -repo coupergateway/couper -releasename $GITHUB_REF_NAME -token $GITHUB_TOKEN
149
- echo "::set-output name=${{ matrix.goarch }}::$(cat ./couper-$GITHUB_REF_NAME-macos-${{ matrix.goarch }}.zip.sha256)"
150
- # - name: 'upload image'
151
- # run: mv ./.macos/couper.dmg ./couper-$GITHUB_REF_NAME-macos-${{ matrix.goarch }}.dmg && github-assets-uploader -f ./couper-$GITHUB_REF_NAME-macos-${{ matrix.goarch }}.dmg -overwrite -repo coupergateway/couper -releasename $GITHUB_REF_NAME -token $GITHUB_TOKEN -mediatype 'application/octet-stream'
141
+ github-assets-uploader -f ./couper-${{ github.ref_name }}-macos-${{ matrix.goarch }}.zip -overwrite -repo coupergateway/couper -releasename ${{ github.ref_name }} -token $GITHUB_TOKEN
142
+ shasum -a 256 ./couper-${{ github.ref_name }}-macos-${{ matrix.goarch }}.zip | cut -d ' ' -f1 > ./couper-${{ github.ref_name }}-macos-${{ matrix.goarch }}.zip.sha256 && github-assets-uploader -f ./couper-${{ github.ref_name }}-macos-${{ matrix.goarch }}.zip.sha256 -overwrite -repo coupergateway/couper -releasename ${{ github.ref_name }} -token $GITHUB_TOKEN
143
+ echo "::set-output name=${{ matrix.goarch }}::$(cat ./couper-${{ github.ref_name }}-macos-${{ matrix.goarch }}.zip.sha256)"
152
144
brewlease :
153
145
name : ' update homebrew formula'
154
146
runs-on : ubuntu-latest
155
147
needs :
156
- - linux-windows
148
+ - build-all
157
149
- macos
158
150
steps :
159
151
- name : ' checkout'
0 commit comments