Skip to content

Commit

Permalink
Update build.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
DrMeepso authored Nov 6, 2024
1 parent 9af1ae8 commit 39fb468
Showing 1 changed file with 64 additions and 33 deletions.
97 changes: 64 additions & 33 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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

0 comments on commit 39fb468

Please sign in to comment.