Skip to content

Commit

Permalink
Use gh cli for managing releases
Browse files Browse the repository at this point in the history
Rather than my bespoke forks of the unmaintained actions that used to do this.
  • Loading branch information
LBPHacker committed Jan 12, 2024
1 parent 4c97bae commit e5cdc12
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 18 deletions.
Empty file modified .github/common.sh
100644 → 100755
Empty file.
4 changes: 4 additions & 0 deletions .github/create-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
set -euo pipefail
IFS=$'\t\n'

gh release create --verify-tag --title $GITHUB_REF_NAME $GITHUB_REF_NAME
Empty file modified .github/force-msys2-bash.sh
100644 → 100755
Empty file.
12 changes: 12 additions & 0 deletions .github/upload-release-asset.sh
Original file line number Diff line number Diff line change
@@ -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
Empty file modified .github/vs-env.sh
100644 → 100755
Empty file.
25 changes: 7 additions & 18 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,9 @@ 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: ${{ github.ref }}
draft: false
prerelease: false
run: bash -c './.github/create-release.sh'
build:
runs-on: ${{ matrix.runs_on }}
name: ${{ matrix.job_name }}
Expand Down Expand Up @@ -64,14 +59,11 @@ jobs:
BSH_VTAG: ${{ needs.prepare.outputs.vtag }}
- if: needs.prepare.outputs.do_release == 'yes'
id: upload_release_asset
uses: LBPHacker/upload-release-asset@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.prepare.outputs.release_upload_url }}
asset_path: temp/libraries.zip
asset_name: ${{ matrix.asset_name }}.zip
asset_content_type: application/zip
ASSET_PATH: temp/libraries.zip
ASSET_NAME: ${{ matrix.asset_name }}.zip
run: bash -c './.github/upload-release-asset.sh'
- if: needs.prepare.outputs.do_release == 'yes'
run: bash -c './.github/wrapfile.sh'
env:
Expand All @@ -84,11 +76,8 @@ jobs:
BSH_VTAG: ${{ needs.prepare.outputs.vtag }}
ASSET_URL: ${{ steps.upload_release_asset.outputs.browser_download_url }}
- if: needs.prepare.outputs.do_release == 'yes'
uses: LBPHacker/upload-release-asset@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.prepare.outputs.release_upload_url }}
asset_path: temp/libraries.wrap
asset_name: ${{ matrix.asset_name }}.wrap
asset_content_type: text/plain
ASSET_PATH: temp/libraries.wrap
ASSET_NAME: ${{ matrix.asset_name }}.wrap
run: bash -c './.github/upload-release-asset.sh'
5 changes: 5 additions & 0 deletions .github/wrapfile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ set -euo pipefail
shopt -s globstar
IFS=$'\n\t'

if [[ -z ${ASSET_URL-} ]]; then
>&2 echo "ASSET_URL not set"
exit 1
fi

. ./.github/common.sh

cd $temp_dir
Expand Down

0 comments on commit e5cdc12

Please sign in to comment.