diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 8088e6ee..3055dae2 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -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