From aff12209d300c3edf5a013ec075ac39afdddaaa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1s=20B=C3=A1lint=20Misius?= Date: Fri, 12 Jan 2024 16:34:34 +0100 Subject: [PATCH] Use gh cli for managing releases Rather than my bespoke forks of the unmaintained actions that used to do this. --- .github/create-release.sh | 4 ++++ .github/upload-release-asset.sh | 12 ++++++++++++ .github/vs-env.sh | 0 .github/workflows/build.yaml | 31 ++++++++++--------------------- 4 files changed, 26 insertions(+), 21 deletions(-) create mode 100755 .github/create-release.sh create mode 100755 .github/upload-release-asset.sh mode change 100644 => 100755 .github/vs-env.sh diff --git a/.github/create-release.sh b/.github/create-release.sh new file mode 100755 index 000000000..51b2585e2 --- /dev/null +++ b/.github/create-release.sh @@ -0,0 +1,4 @@ +set -euo pipefail +IFS=$'\t\n' + +gh release create --draft --verify-tag --title $RELEASE_NAME $GITHUB_REF_NAME diff --git a/.github/upload-release-asset.sh b/.github/upload-release-asset.sh new file mode 100755 index 000000000..bb4015bae --- /dev/null +++ b/.github/upload-release-asset.sh @@ -0,0 +1,12 @@ +set -euo pipefail +IFS=$'\t\n' + +temp=.temp +mkdir $temp +cp $ASSET_PATH $temp/$ASSET_NAME +( + cd $temp + gh release upload $GITHUB_REF_NAME $ASSET_NAME +) +rm -r $temp +echo browser_download_url=https://github.com/$GITHUB_REPOSITORY/releases/download/$GITHUB_REF_NAME/$ASSET_NAME >> $GITHUB_OUTPUT diff --git a/.github/vs-env.sh b/.github/vs-env.sh old mode 100644 new mode 100755 diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index eac943883..8dbfd5cc8 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -16,7 +16,6 @@ jobs: prepare: runs-on: ubuntu-latest outputs: - release_upload_url: ${{ steps.create_release.outputs.upload_url }} do_release: ${{ steps.prepare.outputs.do_release }} build_matrix: ${{ steps.prepare.outputs.build_matrix }} publish_matrix: ${{ steps.prepare.outputs.publish_matrix }} @@ -44,14 +43,10 @@ jobs: GITHUB_REF: ${{ github.ref }} - if: steps.prepare.outputs.do_release == 'yes' id: create_release - uses: LBPHacker/create-release@v2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: ${{ steps.prepare.outputs.release_name }} - draft: true - prerelease: false + RELEASE_NAME: ${{ steps.prepare.outputs.release_name }} + run: bash -c './.github/create-release.sh' build: runs-on: ${{ matrix.runs_on }} name: ${{ matrix.job_name }} @@ -91,24 +86,18 @@ jobs: PACKAGE_MODE: ${{ matrix.package_mode }} ASSET_PATH: ${{ matrix.asset_path }} DEBUG_ASSET_PATH: ${{ matrix.debug_asset_path }} - - uses: LBPHacker/upload-release-asset@v2 # TODO-NTL: ship licenses - if: needs.prepare.outputs.do_release == 'yes' && matrix.publish == 'yes' + - if: needs.prepare.outputs.do_release == 'yes' && matrix.publish == 'yes' # TODO-NTL: ship licenses env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.prepare.outputs.release_upload_url }} - asset_path: build/${{ matrix.asset_path }} - asset_name: ${{ matrix.asset_name }} - asset_content_type: application/zip - - uses: LBPHacker/upload-release-asset@v2 - if: needs.prepare.outputs.do_release == 'yes' && matrix.publish == 'yes' && matrix.separate_debug == 'yes' + ASSET_PATH: build/${{ matrix.asset_path }} + ASSET_NAME: ${{ matrix.asset_name }} + run: bash -c './.github/upload-release-asset.sh' + - if: needs.prepare.outputs.do_release == 'yes' && matrix.publish == 'yes' && matrix.separate_debug == 'yes' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.prepare.outputs.release_upload_url }} - asset_path: build/${{ matrix.debug_asset_path }} - asset_name: ${{ matrix.debug_asset_name }} - asset_content_type: application/zip + ASSET_PATH: build/${{ matrix.debug_asset_path }} + ASSET_NAME: ${{ matrix.debug_asset_name }} + run: bash -c './.github/upload-release-asset.sh' - uses: actions/upload-artifact@v3 if: matrix.artifact == 'yes' with: