diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 1b67acf..d1c6b51 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -33,38 +33,12 @@ jobs: - name: Zip the Windows publish folder run: zip -r ./publish/win64.zip ./publish - # Step 6: Delete existing nightly release and tag if it exists - - name: Delete existing nightly release and tag - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - # Find and delete existing release with tag 'nightly' - gh release delete nightly -y || true - # Delete existing tag 'nightly' if it exists - gh api -X DELETE repos/${{ github.repository }}/git/refs/tags/nightly || true - - # Step 7: Create a nightly release - - name: Create GitHub Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: "nightly" # Static tag name for nightly builds - release_name: "nightly-${{ github.run_number }}" # Unique name for each run - draft: false - prerelease: true # Mark as prerelease if you want to differentiate - - # Step 8: Upload Windows build to release + # Step 6: Upload the Windows build as an artifact to be used in release - name: Upload Windows Build Artifact - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: actions/upload-artifact@v3 with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./publish/win64.zip - asset_name: win64.zip - asset_content_type: application/zip + name: win64 + path: ./publish/win64.zip # Linux Build Job linux-build: @@ -97,13 +71,70 @@ jobs: - name: Zip the Linux publish folder run: zip -r ./publish/linux64.zip ./publish - # Step 7: Upload Linux build to release + # Step 7: Upload the Linux build as an artifact to be used in release - name: Upload Linux Build Artifact + uses: actions/upload-artifact@v3 + with: + name: linux64 + path: ./publish/linux64.zip + + # Create Release Job + create-release: + runs-on: ubuntu-latest + needs: [windows-build, linux-build] # Waits for both builds to finish + + steps: + # Step 1: Download artifacts from previous jobs + - name: Download Windows Artifact + uses: actions/download-artifact@v3 + with: + name: win64 + + - name: Download Linux Artifact + uses: actions/download-artifact@v3 + with: + name: linux64 + + # Step 2: Delete existing nightly release and tag if it exists + - name: Delete existing nightly release and tag + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # Find and delete existing release with tag 'nightly' + gh release delete nightly -y || true + # Delete existing tag 'nightly' if it exists + gh api -X DELETE repos/${{ github.repository }}/git/refs/tags/nightly || true + + # Step 3: Create a new nightly release + - name: Create GitHub Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: "nightly" # Static tag name for nightly builds + release_name: "nightly-${{ github.run_number }}" # Unique name for each run + draft: false + prerelease: true # Mark as prerelease if you want to differentiate + + # Step 4: Upload Windows artifact to release + - name: Upload Windows Build to Release + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: win64.zip + asset_name: win64.zip + asset_content_type: application/zip + + # Step 5: Upload Linux artifact to release + - name: Upload Linux Build to Release uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - upload_url: ${{ steps.windows-build.outputs.create_release.outputs.upload_url }} - asset_path: ./publish/linux64.zip + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: linux64.zip asset_name: linux64.zip asset_content_type: application/zip