1515
1616permissions :
1717 contents : write # needed to write releases
18+ id-token : write # needed for keyless signing
1819
1920jobs :
2021
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-
4522 linux-amd64-release :
4623 runs-on : ubuntu-latest
47- needs : github_release
4824 steps :
4925 - name : Checkout
5026 uses : actions/checkout@v2
6238
6339 tar -zcvf linux-x86_64-libgit2-all-libs.tar.gz libgit2-linux-libgit2-all
6440 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
7541
7642 - name : Build static libraries - libgit2 only
7743 run : |
@@ -85,16 +51,11 @@ jobs:
8551
8652 tar -zcvf linux-x86_64-libgit2-only-lib.tar.gz libgit2-linux-libgit2-only
8753 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
9355 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
9859
9960 darwin-release :
10061 # This job builds and releases "universal libraries" that are
10869 # of testing, GitHub's macos-10.15 did not seem to.
10970 # Cross-compiling to arm64 on that runner consistently failed.
11071 runs-on : macos-11
111- needs : github_release
11272 steps :
11373 - name : Checkout
11474 uses : actions/checkout@v2
@@ -156,16 +116,6 @@ jobs:
156116 rm -rf ${GITHUB_WORKSPACE}/build ${GITHUB_WORKSPACE}/libgit2
157117 env :
158118 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
169119
170120 - name : Build universal static libraries for Darwin - libgit2 only
171121 run : |
@@ -191,13 +141,34 @@ jobs:
191141 rm -rf ${GITHUB_WORKSPACE}/build ${GITHUB_WORKSPACE}/libgit2
192142 env :
193143 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 }}
144+ - uses : actions/upload-artifact@v3
145+ with :
146+ name : release-artifact
147+ path : ' *.tar.gz'
148+ if-no-files-found : error
149+
150+ goreleaser :
151+ runs-on : ubuntu-latest
152+ needs : [linux-amd64-release, darwin-release]
153+ if : ${{ always() && contains(join(needs.*.result, ','), 'success') }}
154+ steps :
155+ - uses : actions/checkout@v2
156+ with :
157+ fetch-depth : 0
158+ - uses : actions/setup-go@v2
159+ with :
160+ go-version : 1.17.x
161+ - name : Setup Cosign
162+ uses : sigstore/cosign-installer@main
163+ - name : Setup Syft
164+ uses : anchore/sbom-action/download-syft@v0
165+ - name : Download Files
166+ uses : actions/download-artifact@v3
199167 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
168+ name : release-artifact
169+ - uses : goreleaser/goreleaser-action@v2
170+ with :
171+ version : latest
172+ args : release --rm-dist
173+ env :
174+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments