Skip to content

Commit

Permalink
gha: simplify uploading releases by using gh cli tool
Browse files Browse the repository at this point in the history
  • Loading branch information
a1batross committed Aug 12, 2024
1 parent c70c13e commit a6b1e57
Showing 1 changed file with 19 additions and 21 deletions.
40 changes: 19 additions & 21 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,34 +92,32 @@ jobs:
needs: [build, flatpak]
if: ${{ github.event_name == 'push' }}
steps:
- name: Remove old release
run: |
gh release delete -y --cleanup-tag -R $GITHUB_REPOSITORY ${{ github.ref_name == 'master' && 'continuous' || format('continuous-{0}', github.ref_name) }} || true
- name: Remove old release, fetch artifacts, repackage binaries and upload new release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Fetch artifacts
uses: actions/download-artifact@v4
with:
path: artifacts/
- name: Repackage binaries and allow GitHub to process removed release for few seconds
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_TAG: ${{ github.ref_name == 'master' && 'continuous' || format('continuous-{0}', github.ref_name) }}
run: |
gh release delete "$RELEASE_TAG" \
--yes \
--cleanup-tag \
--repo "$GITHUB_REPOSITORY" || true
gh run download "$GITHUB_RUN_ID" \
--dir artifacts/ \
--repo "$GITHUB_REPOSITORY"
pushd artifacts/
echo "Found artifacts:"
ls -R .
for i in $(ls artifact-* su.xash.Engine.*); do
ls
for i in $(find -mindepth 1 -maxdepth 1 -type d); do
mv "$i"/* .
rm -rf "$i"
done
echo "Repackaged artifacts:"
ls -R .
ls -R
popd
sleep 20s
- name: Upload new release
uses: FWGS/action-gh-release@v2.0.8
with:
name: Xash3D FWGS Continuous ${{ github.ref_name }} Build
tag_name: ${{ github.ref_name == 'master' && 'continuous' || format('continuous-{0}', github.ref_name) }}
prerelease: true
token: ${{ secrets.GITHUB_TOKEN }}
files: artifacts/*
draft: false
gh release create "$RELEASE_TAG" artifacts/* \
--title "Xash3D FWGS Continuous ${{ github.ref_name }} Build" \
--target $GITHUB_SHA \
--repo "$GITHUB_REPOSITORY" \
--prerelease \
--generate-notes

0 comments on commit a6b1e57

Please sign in to comment.