Use gh cli for managing releases

Rather than my bespoke forks of the unmaintained actions that used to do this.
This commit is contained in:
Tamás Bálint Misius 2024-01-12 16:34:34 +01:00
parent 5da4c04f35
commit aff12209d3
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2
4 changed files with 26 additions and 21 deletions

4
.github/create-release.sh vendored Executable file
View File

@ -0,0 +1,4 @@
set -euo pipefail
IFS=$'\t\n'
gh release create --draft --verify-tag --title $RELEASE_NAME $GITHUB_REF_NAME

12
.github/upload-release-asset.sh vendored Executable file
View File

@ -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

0
.github/vs-env.sh vendored Normal file → Executable file
View File

View File

@ -16,7 +16,6 @@ jobs:
prepare: prepare:
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
release_upload_url: ${{ steps.create_release.outputs.upload_url }}
do_release: ${{ steps.prepare.outputs.do_release }} do_release: ${{ steps.prepare.outputs.do_release }}
build_matrix: ${{ steps.prepare.outputs.build_matrix }} build_matrix: ${{ steps.prepare.outputs.build_matrix }}
publish_matrix: ${{ steps.prepare.outputs.publish_matrix }} publish_matrix: ${{ steps.prepare.outputs.publish_matrix }}
@ -44,14 +43,10 @@ jobs:
GITHUB_REF: ${{ github.ref }} GITHUB_REF: ${{ github.ref }}
- if: steps.prepare.outputs.do_release == 'yes' - if: steps.prepare.outputs.do_release == 'yes'
id: create_release id: create_release
uses: LBPHacker/create-release@v2
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: RELEASE_NAME: ${{ steps.prepare.outputs.release_name }}
tag_name: ${{ github.ref }} run: bash -c './.github/create-release.sh'
release_name: ${{ steps.prepare.outputs.release_name }}
draft: true
prerelease: false
build: build:
runs-on: ${{ matrix.runs_on }} runs-on: ${{ matrix.runs_on }}
name: ${{ matrix.job_name }} name: ${{ matrix.job_name }}
@ -91,24 +86,18 @@ jobs:
PACKAGE_MODE: ${{ matrix.package_mode }} PACKAGE_MODE: ${{ matrix.package_mode }}
ASSET_PATH: ${{ matrix.asset_path }} ASSET_PATH: ${{ matrix.asset_path }}
DEBUG_ASSET_PATH: ${{ matrix.debug_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' # TODO-NTL: ship licenses
if: needs.prepare.outputs.do_release == 'yes' && matrix.publish == 'yes'
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: ASSET_PATH: build/${{ matrix.asset_path }}
upload_url: ${{ needs.prepare.outputs.release_upload_url }} ASSET_NAME: ${{ matrix.asset_name }}
asset_path: build/${{ matrix.asset_path }} run: bash -c './.github/upload-release-asset.sh'
asset_name: ${{ matrix.asset_name }} - if: needs.prepare.outputs.do_release == 'yes' && matrix.publish == 'yes' && matrix.separate_debug == 'yes'
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'
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: ASSET_PATH: build/${{ matrix.debug_asset_path }}
upload_url: ${{ needs.prepare.outputs.release_upload_url }} ASSET_NAME: ${{ matrix.debug_asset_name }}
asset_path: build/${{ matrix.debug_asset_path }} run: bash -c './.github/upload-release-asset.sh'
asset_name: ${{ matrix.debug_asset_name }}
asset_content_type: application/zip
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v3
if: matrix.artifact == 'yes' if: matrix.artifact == 'yes'
with: with: