15
15
16
16
permissions :
17
17
contents : write # needed to write releases
18
+ id-token : write # needed for keyless signing
18
19
19
20
jobs :
20
21
21
- github_release :
22
- runs-on : ubuntu-latest
23
- outputs :
24
- release_upload_url : ${{ steps.create_release.outputs.upload_url }}
25
- steps :
26
- - name : Prepare
27
- id : prep
28
- run : |
29
- VERSION="${{ github.event.inputs.tag }}-${GITHUB_SHA::8}"
30
- if [[ $GITHUB_REF == refs/tags/* ]]; then
31
- VERSION=${GITHUB_REF/refs\/tags\//}
32
- fi
33
- echo ::set-output name=VERSION::${VERSION}
34
- - name : Create Release
35
- id : create_release
36
- uses : actions/create-release@v1
37
- env :
38
- GITHUB_TOKEN : ${{ github.token }}
39
- with :
40
- release_name : ${{ steps.prep.outputs.VERSION }}
41
- tag_name : ${{ steps.prep.outputs.VERSION }}
42
- draft : false
43
- prerelease : true
44
-
45
22
linux-amd64-release :
46
23
runs-on : ubuntu-latest
47
- needs : github_release
48
24
steps :
49
25
- name : Checkout
50
26
uses : actions/checkout@v2
62
38
63
39
tar -zcvf linux-x86_64-libgit2-all-libs.tar.gz libgit2-linux-libgit2-all
64
40
rm -rf ${GITHUB_WORKSPACE}/build ${GITHUB_WORKSPACE}/libgit2
65
- - name : Upload Release Asset
66
- id : upload-release-asset-libgit2-all
67
- uses : actions/upload-release-asset@v1
68
- env :
69
- GITHUB_TOKEN : ${{ github.token }}
70
- with :
71
- upload_url : ${{ needs.github_release.outputs.release_upload_url }}
72
- asset_path : ./linux-x86_64-libgit2-all-libs.tar.gz
73
- asset_name : linux-x86_64-libgit2-all-libs.tar.gz
74
- asset_content_type : application/gzip
75
41
76
42
- name : Build static libraries - libgit2 only
77
43
run : |
@@ -85,16 +51,11 @@ jobs:
85
51
86
52
tar -zcvf linux-x86_64-libgit2-only-lib.tar.gz libgit2-linux-libgit2-only
87
53
rm -rf ${GITHUB_WORKSPACE}/build ${GITHUB_WORKSPACE}/libgit2
88
- - name : Upload Release Asset
89
- id : upload-release-asset-libgit2-only
90
- uses : actions/upload-release-asset@v1
91
- env :
92
- GITHUB_TOKEN : ${{ github.token }}
54
+ - uses : actions/upload-artifact@v3
93
55
with :
94
- upload_url : ${{ needs.github_release.outputs.release_upload_url }}
95
- asset_path : ./linux-x86_64-libgit2-only-lib.tar.gz
96
- asset_name : linux-x86_64-libgit2-only-lib.tar.gz
97
- asset_content_type : application/gzip
56
+ name : release-artifact
57
+ path : ' *.tar.gz'
58
+ if-no-files-found : error
98
59
99
60
darwin-release :
100
61
# This job builds and releases "universal libraries" that are
108
69
# of testing, GitHub's macos-10.15 did not seem to.
109
70
# Cross-compiling to arm64 on that runner consistently failed.
110
71
runs-on : macos-11
111
- needs : github_release
112
72
steps :
113
73
- name : Checkout
114
74
uses : actions/checkout@v2
@@ -156,16 +116,6 @@ jobs:
156
116
rm -rf ${GITHUB_WORKSPACE}/build ${GITHUB_WORKSPACE}/libgit2
157
117
env :
158
118
MACOSX_DEPLOYMENT_TARGET : 10.15
159
- - name : Upload Release Asset
160
- id : upload-release-asset-libgit2-all
161
- uses : actions/upload-release-asset@v1
162
- env :
163
- GITHUB_TOKEN : ${{ github.token }}
164
- with :
165
- upload_url : ${{ needs.github_release.outputs.release_upload_url }}
166
- asset_path : ./darwin-libgit2-all-libs.tar.gz
167
- asset_name : darwin-libgit2-all-libs.tar.gz
168
- asset_content_type : application/gzip
169
119
170
120
- name : Build universal static libraries for Darwin - libgit2 only
171
121
run : |
@@ -179,9 +129,8 @@ jobs:
179
129
CMAKE_APPLE_SILICON_PROCESSOR=arm64 \
180
130
./hack/static.sh build_libgit2_only
181
131
182
- mkdir -p ./libgit2-darwin-libgit2-only
132
+ mkdir -p ./libgit2-darwin-libgit2-only/lib
183
133
mv ${GITHUB_WORKSPACE}/build/libgit2-darwin-amd64/include ./libgit2-darwin-libgit2-only/
184
- mv ${GITHUB_WORKSPACE}/build/libgit2-darwin-amd64/lib ./libgit2-darwin-libgit2-only/
185
134
186
135
libtool -static -o ./libgit2-darwin-libgit2-only/lib/libgit2.a \
187
136
${GITHUB_WORKSPACE}/build/libgit2-darwin-amd64/lib/libgit2.a \
@@ -191,13 +140,34 @@ jobs:
191
140
rm -rf ${GITHUB_WORKSPACE}/build ${GITHUB_WORKSPACE}/libgit2
192
141
env :
193
142
MACOSX_DEPLOYMENT_TARGET : 10.15
194
- - name : Upload Release Asset
195
- id : upload-release-asset-libgit2-only
196
- uses : actions/upload-release-asset@v1
197
- env :
198
- GITHUB_TOKEN : ${{ github.token }}
143
+ - uses : actions/upload-artifact@v3
144
+ with :
145
+ name : release-artifact
146
+ path : ' *.tar.gz'
147
+ if-no-files-found : error
148
+
149
+ goreleaser :
150
+ runs-on : ubuntu-latest
151
+ needs : [linux-amd64-release, darwin-release]
152
+ if : ${{ always() && contains(join(needs.*.result, ','), 'success') }}
153
+ steps :
154
+ - uses : actions/checkout@v2
155
+ with :
156
+ fetch-depth : 0
157
+ - uses : actions/setup-go@v2
158
+ with :
159
+ go-version : 1.17.x
160
+ - name : Setup Cosign
161
+ uses : sigstore/cosign-installer@main
162
+ - name : Setup Syft
163
+ uses : anchore/sbom-action/download-syft@v0
164
+ - name : Download Files
165
+ uses : actions/download-artifact@v3
199
166
with :
200
- upload_url : ${{ needs.github_release.outputs.release_upload_url }}
201
- asset_path : ./darwin-libs-libgit2-only.tar.gz
202
- asset_name : darwin-libs-libgit2-only.tar.gz
203
- asset_content_type : application/gzip
167
+ name : release-artifact
168
+ - uses : goreleaser/goreleaser-action@v2
169
+ with :
170
+ version : latest
171
+ args : release --rm-dist
172
+ env :
173
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments