@@ -12,12 +12,11 @@ permissions:
12
12
actions : write
13
13
14
14
jobs :
15
- linux-build :
16
- runs-on : ubuntu -latest
15
+ release :
16
+ runs-on : macos -latest
17
17
permissions :
18
- packages : write
19
- contents : read
20
-
18
+ packages : read
19
+ contents : write
21
20
steps :
22
21
-
23
22
name : Cancel previous workflows
36
35
with :
37
36
go-version : ' 1.17'
38
37
check-latest : true
39
- -
40
- name : Set up Cosign
41
- uses : sigstore/cosign-installer@v2.0.1
42
38
-
43
39
name : Cache Go modules
44
40
uses : actions/cache@v1
47
43
key : ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
48
44
restore-keys : |
49
45
${{ runner.os }}-go-
46
+ -
47
+ name : Download cyclonedx-gomod
48
+ uses : CycloneDX/gh-gomod-generate-sbom@v1
49
+ with :
50
+ version : v1.2.0
51
+ -
52
+ uses : sigstore/cosign-installer@v2
53
+ -
54
+ name : Import Code-Signing Certificates
55
+ uses : Apple-Actions/import-codesign-certs@v1
56
+ with :
57
+ p12-file-base64 : ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }}
58
+ p12-password : ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }}
59
+ -
60
+ name : Install gon via HomeBrew for code signing and app notarization
61
+ run : |
62
+ brew tap mitchellh/gon
63
+ brew install mitchellh/gon/gon
50
64
-
51
65
name : Run GoReleaser
52
66
uses : goreleaser/goreleaser-action@v2
55
69
args : release --rm-dist --skip-publish
56
70
env :
57
71
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
72
+ -
73
+ name : Prepare Github release packages
74
+ run : |
75
+ mkdir .dist
76
+ cp "./dist/harp-*" .dist/
77
+ -
78
+ name : Sign and notarize AMD64 cli
79
+ run : |
80
+ echo '{
81
+ "source": ["./dist/harp-darwin-amd64"]
82
+ "bundle_id":"co.elastic.harp",
83
+ "apple_id": {},
84
+ "sign": { "application_identity": "9470D0A7B70090A8EF31C3B33AB3868B38B27A3D" },
85
+ "zip": {
86
+ "output_path": "./.dist/harp-darwin-amd64.zip"
87
+ }
88
+ }' | jq '' > gon.json
89
+ gon -log-level=debug -log-json ./gon.json
90
+ rm -f .dist/harp-darwin-amd64
91
+ - name : Sign and notarize ARM64 cli
92
+ run : |
93
+ echo '{
94
+ "source": ["./dist/harp-darwin-arm64"]
95
+ "bundle_id":"co.elastic.harp",
96
+ "apple_id": {},
97
+ "sign": { "application_identity": "9470D0A7B70090A8EF31C3B33AB3868B38B27A3D" },
98
+ "zip": {
99
+ "output_path": "./.dist/harp-darwin-arm64.zip"
100
+ }
101
+ }' | jq '' > gon.json
102
+ gon -log-level=debug -log-json ./gon.json
103
+ rm -f .dist/harp-darwin-arm64
104
+ -
105
+ name : Generate provenance for Release
106
+ uses : philips-labs/slsa-provenance-action@v0.7.2
107
+ with :
108
+ command : generate
109
+ subcommand : files
110
+ arguments : --artifact-path .dist --output-path '.dist/provenance.json'
111
+ env :
112
+ GITHUB_TOKEN : " ${{ secrets.GITHUB_TOKEN }}"
113
+ -
114
+ name : Sign
115
+ shell : bash
116
+ run : |
117
+ #!/bin/bash
118
+ shopt -s expand_aliases
119
+ cd .dist
120
+ FILES="*"
121
+ for f in $FILES;
122
+ do
123
+ case $f in
124
+ *.sbom.json)
125
+ continue
126
+ ;;
127
+ provenance.json)
128
+ cosign sign-blob --key <(echo -n "${COSIGN_KEY}") "$f" > "$f.sig"
129
+ ;;
130
+ harp-*)
131
+ sha256sum "$f" | cut -d " " -f 1 > "$f.sha256"
132
+ cosign sign-blob --key <(echo -n "${COSIGN_KEY}") "$f" > "$f.sig"
133
+ ;;
134
+ esac
135
+ done
136
+ env :
137
+ COSIGN_KEY : ${{ secrets.COSIGN_KEY }}
138
+ COSIGN_PASSWORD : ${{ secrets.COSIGN_PASSWORD }}
139
+ -
140
+ name : Verify
141
+ shell : bash
142
+ run : |
143
+ #!/bin/bash
144
+ shopt -s expand_aliases
145
+ curl -sLO https://raw.githubusercontent.com/elastic/harp/cmd/harp/v${{ github.event.inputs.release }}/build/artifact/cosign.pub
146
+ cd .dist
147
+ FILES="*"
148
+ for f in $FILES;
149
+ do
150
+ if [[ -f "$f.sig" ]];
151
+ then
152
+ cosign verify-blob --key ../cosign.pub --signature "$f.sig" $f
153
+ fi
154
+ done
155
+ -
156
+ name : Upload to release
157
+ uses : AButler/upload-release-assets@v2.0
158
+ with :
159
+ files : ' .dist/*'
160
+ repo-token : ${{ secrets.GITHUB_TOKEN }}
161
+ release-tag : v${{ github.event.inputs.release }}
0 commit comments