diff options
| author | Joshua Sing <joshua@joshuasing.dev> | 2026-05-04 20:01:30 +1000 |
|---|---|---|
| committer | Joshua Sing <joshua@joshuasing.dev> | 2026-05-04 21:06:53 +1000 |
| commit | 85f4c66646e91893eb80a4c75649511a7d3c33e6 (patch) | |
| tree | 505f75b9972b23c74ac5bb36db7a6ca096c5f9f8 | |
| parent | 1feb9300fbf4ec2103b423d9c72cd12856210b21 (diff) | |
| download | portable-85f4c66646e91893eb80a4c75649511a7d3c33e6.tar.gz portable-85f4c66646e91893eb80a4c75649511a7d3c33e6.tar.bz2 portable-85f4c66646e91893eb80a4c75649511a7d3c33e6.zip | |
ci: rework release workflow for immutable releases
Switch the release workflow to create a draft release, and upload the
build artifacts to the draft, using the gh CLI instead of
softprops/action-gh-release. This prepares for enabling immutable
releases, which require all assets to be uploaded prior to publishing.
The release process now requires a maintainer to manually publish the
draft release once all CI artifacts have been uploaded and any
remaining assets (e.g. the source tarball, checksums and signatures
files) have been attached.
While modifying release.yml:
- Tighten workflow permissions: default to no permissions and grant
contents: write to both jobs.
- Set persist-credentials: false on actions/checkout so the
GITHUB_TOKEN is not left in .git/config during runs.
- Set cancel-in-progress: false to prevent a second tag push from
canceling an already-running workflow and leaving a dangling release.
- Move all ${{ ... }} expressions in run blocks into env to avoid shell
interpolation of workflow context values.
- Add name key to every step in build-windows.
| -rw-r--r-- | .github/workflows/release.yml | 69 |
1 files changed, 47 insertions, 22 deletions
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 96672a4..976467c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml | |||
| @@ -6,37 +6,45 @@ on: | |||
| 6 | tags: [ "v*" ] | 6 | tags: [ "v*" ] |
| 7 | 7 | ||
| 8 | concurrency: | 8 | concurrency: |
| 9 | group: "${{ github.workflow }}-${{ github.event.number || github.ref }}" | 9 | group: "${{ github.workflow }}-${{ github.ref }}" |
| 10 | cancel-in-progress: true | 10 | cancel-in-progress: false |
| 11 | 11 | ||
| 12 | permissions: | 12 | permissions: {} |
| 13 | contents: write | ||
| 14 | 13 | ||
| 15 | jobs: | 14 | jobs: |
| 16 | release: | 15 | release: |
| 17 | name: "Release" | 16 | name: "Release" |
| 18 | runs-on: "ubuntu-24.04" | 17 | runs-on: "ubuntu-24.04" |
| 19 | outputs: | 18 | permissions: |
| 20 | upload_url: "${{ steps.create_release.outputs.upload_url }}" | 19 | contents: write # Required to create release. |
| 21 | steps: | 20 | steps: |
| 22 | - name: "Checkout repository" | 21 | - name: "Checkout repository" |
| 23 | uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | 22 | uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 23 | with: | ||
| 24 | persist-credentials: false | ||
| 24 | 25 | ||
| 25 | - name: "Generate version changelog" | 26 | - name: "Generate version changelog" |
| 26 | run: .github/scripts/changelog.sh "$VERSION" > release-changelog.txt | 27 | run: .github/scripts/changelog.sh "$VERSION" > release-changelog.txt |
| 27 | env: | 28 | env: |
| 28 | VERSION: "${{ github.ref_name }}" | 29 | VERSION: "${{ github.ref_name }}" |
| 29 | 30 | ||
| 30 | - name: "Create GitHub release" | 31 | - name: "Create draft GitHub release" |
| 31 | id: create_release | 32 | env: |
| 32 | uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3 | 33 | GH_TOKEN: "${{ github.token }}" |
| 33 | with: | 34 | VERSION: "${{ github.ref_name }}" |
| 34 | body_path: "${{ github.workspace }}/release-changelog.txt" | 35 | run: | |
| 36 | gh release create "$VERSION" \ | ||
| 37 | --repo "$GITHUB_REPOSITORY" \ | ||
| 38 | --title "$VERSION" \ | ||
| 39 | --notes-file release-changelog.txt \ | ||
| 40 | --draft | ||
| 35 | 41 | ||
| 36 | build-windows: | 42 | build-windows: |
| 37 | name: "${{ matrix.os }}/${{ matrix.arch }}" | 43 | name: "${{ matrix.os }}/${{ matrix.arch }}" |
| 38 | runs-on: "${{ matrix.os }}" | 44 | runs-on: "${{ matrix.os }}" |
| 39 | needs: ["release"] | 45 | needs: ["release"] |
| 46 | permissions: | ||
| 47 | contents: write # Required to upload release assets. | ||
| 40 | strategy: | 48 | strategy: |
| 41 | matrix: | 49 | matrix: |
| 42 | os: [ "windows-2022" ] | 50 | os: [ "windows-2022" ] |
| @@ -44,6 +52,8 @@ jobs: | |||
| 44 | steps: | 52 | steps: |
| 45 | - name: "Checkout repository" | 53 | - name: "Checkout repository" |
| 46 | uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | 54 | uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 55 | with: | ||
| 56 | persist-credentials: false | ||
| 47 | 57 | ||
| 48 | - name: "Setup MSYS2" | 58 | - name: "Setup MSYS2" |
| 49 | uses: msys2/setup-msys2@e9898307ac31d1a803454791be09ab9973336e1c # v2.31.1 | 59 | uses: msys2/setup-msys2@e9898307ac31d1a803454791be09ab9973336e1c # v2.31.1 |
| @@ -59,23 +69,38 @@ jobs: | |||
| 59 | patch | 69 | patch |
| 60 | perl | 70 | perl |
| 61 | 71 | ||
| 62 | - shell: msys2 {0} | 72 | - name: "Run autogen" |
| 73 | shell: msys2 {0} | ||
| 63 | run: ./autogen.sh | 74 | run: ./autogen.sh |
| 64 | 75 | ||
| 65 | - shell: cmd | 76 | - name: "Configure" |
| 66 | run: cmake -Bbuild -G "Visual Studio 17 2022" -A ${{ matrix.arch }} -DCMAKE_INSTALL_PREFIX=local | 77 | shell: pwsh |
| 78 | env: | ||
| 79 | ARCH: "${{ matrix.arch }}" | ||
| 80 | run: cmake -Bbuild -G "Visual Studio 17 2022" -A "${env:ARCH}" -DCMAKE_INSTALL_PREFIX=local | ||
| 67 | 81 | ||
| 68 | - shell: cmd | 82 | - name: "Build" |
| 83 | shell: pwsh | ||
| 69 | run: cmake --build build --config Release | 84 | run: cmake --build build --config Release |
| 70 | 85 | ||
| 71 | - shell: cmd | 86 | - name: "Install" |
| 87 | shell: pwsh | ||
| 72 | run: cmake --install build --config Release | 88 | run: cmake --install build --config Release |
| 73 | 89 | ||
| 74 | - shell: pwsh | 90 | - name: "Package release artifact" |
| 75 | run: Compress-Archive -Path local\* "libressl_${{ github.ref_name }}_windows_${{ matrix.arch }}.zip" | 91 | shell: pwsh |
| 92 | env: | ||
| 93 | VERSION: "${{ github.ref_name }}" | ||
| 94 | ARCH: "${{ matrix.arch }}" | ||
| 95 | run: Compress-Archive -Path local\* "libressl_${env:VERSION}_windows_${env:ARCH}.zip" | ||
| 76 | 96 | ||
| 77 | - name: "Upload release artifact" | 97 | - name: "Upload release artifact" |
| 78 | uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3 | 98 | shell: bash |
| 79 | with: | 99 | env: |
| 80 | files: | | 100 | GH_TOKEN: "${{ github.token }}" |
| 81 | libressl_${{ github.ref_name }}_windows_${{ matrix.arch }}.zip | 101 | VERSION: "${{ github.ref_name }}" |
| 102 | ARCH: "${{ matrix.arch }}" | ||
| 103 | run: | | ||
| 104 | gh release upload "$VERSION" \ | ||
| 105 | --repo "$GITHUB_REPOSITORY" \ | ||
| 106 | "libressl_${VERSION}_windows_${ARCH}.zip" | ||
