1- name : " Publish the PHAR for Releases "
1+ name : " Publish a draft release with PHAR attached "
22
33on :
4- release :
5- types :
6- - published
4+ push :
5+ tags :
6+ - ' * '
77
88permissions :
99 contents : read
@@ -17,10 +17,32 @@ jobs:
1717 attestations : write
1818 uses : ./.github/workflows/build-phar.yml
1919
20- release-phar :
20+ create-draft-release :
2121 runs-on : ubuntu-latest
2222 needs :
2323 - build-phar
24+ permissions :
25+ # contents:write is required to create the draft release
26+ contents : write
27+ steps :
28+ - uses : actions/checkout@v4
29+ with :
30+ fetch-tags : ' true'
31+ ref : ${{ github.ref }}
32+ # The changelog is generated locally using jwage/changelog-generator and
33+ # that forms the signed tag body. The `--notes-from-tag` option below
34+ # will copy the release notes from the tag so it will contain the changelog
35+ # Note we must create a *draft* release first, to allow attaching assets
36+ # before the release is finalised when using immutable releases.
37+ - name : Create draft release from tag
38+ env :
39+ GH_TOKEN : ${{ github.token }}
40+ run : gh release create "${{ github.ref_name }}" --title "${{ github.ref_name }}" --draft --notes-from-tag
41+
42+ release-phar :
43+ runs-on : ubuntu-latest
44+ needs :
45+ - create-draft-release
2446 permissions :
2547 # contents:write is required to upload the binaries to the release.
2648 contents : write
@@ -33,11 +55,15 @@ jobs:
3355 env :
3456 GH_TOKEN : ${{ github.token }}
3557 run : gh attestation verify pie.phar --repo ${{ github.repository }}
36- - name : Upload binaries to release
37- uses : softprops/action-gh-release@v2
38- if : ${{startsWith(github.ref, 'refs/tags/') }}
39- with :
40- files : pie.phar
58+ # Once the PHAR has been attached to the release, it is ready for review
59+ # before publishing it. Note that if immutable releases are enabled,
60+ # the tag, pre-release/latest release flag, and all assets become
61+ # immutable, so checking this over is a manual exercise.
62+ # More info: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/immutable-releases
63+ - name : Attach an asset to the draft release
64+ env :
65+ GH_TOKEN : ${{ github.token }}
66+ run : gh release upload "${{ github.ref_name }}" "pie.phar" --clobber
4167
4268 build-and-push-docker-image :
4369 if : ${{ startsWith(github.ref, 'refs/tags/') }}
0 commit comments