gha: simplify uploading releases by using gh cli tool
This commit is contained in:
parent
c70c13eb5c
commit
a6b1e57ae1
1 changed files with 19 additions and 21 deletions
38
.github/workflows/c-cpp.yml
vendored
38
.github/workflows/c-cpp.yml
vendored
|
@ -92,34 +92,32 @@ jobs:
|
||||||
needs: [build, flatpak]
|
needs: [build, flatpak]
|
||||||
if: ${{ github.event_name == 'push' }}
|
if: ${{ github.event_name == 'push' }}
|
||||||
steps:
|
steps:
|
||||||
- name: Remove old release
|
- name: Remove old release, fetch artifacts, repackage binaries and upload new release
|
||||||
run: |
|
|
||||||
gh release delete -y --cleanup-tag -R $GITHUB_REPOSITORY ${{ github.ref_name == 'master' && 'continuous' || format('continuous-{0}', github.ref_name) }} || true
|
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Fetch artifacts
|
RELEASE_TAG: ${{ github.ref_name == 'master' && 'continuous' || format('continuous-{0}', github.ref_name) }}
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
path: artifacts/
|
|
||||||
- name: Repackage binaries and allow GitHub to process removed release for few seconds
|
|
||||||
run: |
|
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/
|
pushd artifacts/
|
||||||
echo "Found artifacts:"
|
echo "Found artifacts:"
|
||||||
ls -R .
|
ls
|
||||||
for i in $(ls artifact-* su.xash.Engine.*); do
|
for i in $(find -mindepth 1 -maxdepth 1 -type d); do
|
||||||
mv "$i"/* .
|
mv "$i"/* .
|
||||||
rm -rf "$i"
|
rm -rf "$i"
|
||||||
done
|
done
|
||||||
echo "Repackaged artifacts:"
|
echo "Repackaged artifacts:"
|
||||||
ls -R .
|
ls -R
|
||||||
popd
|
popd
|
||||||
sleep 20s
|
sleep 20s
|
||||||
- name: Upload new release
|
gh release create "$RELEASE_TAG" artifacts/* \
|
||||||
uses: FWGS/action-gh-release@v2.0.8
|
--title "Xash3D FWGS Continuous ${{ github.ref_name }} Build" \
|
||||||
with:
|
--target $GITHUB_SHA \
|
||||||
name: Xash3D FWGS Continuous ${{ github.ref_name }} Build
|
--repo "$GITHUB_REPOSITORY" \
|
||||||
tag_name: ${{ github.ref_name == 'master' && 'continuous' || format('continuous-{0}', github.ref_name) }}
|
--prerelease \
|
||||||
prerelease: true
|
--generate-notes
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
files: artifacts/*
|
|
||||||
draft: false
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue