update readme and workflow file #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Nightly Release on Commit | |
on: | |
push: | |
branches: | |
- main # Trigger on pushes to main branch | |
jobs: | |
# Windows Build Job | |
windows-build: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the code | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# Step 2: Set up .NET for Windows | |
- name: Set up .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '6.0.x' # Specify your .NET version | |
# Step 3: Restore dependencies | |
- name: Restore dependencies | |
run: dotnet restore | |
# Step 4: Publish the project as a single file for Windows 64-bit | |
- name: Publish the application (Windows) | |
run: dotnet publish -c Release -r win-x64 -p:PublishSingleFile=true -p:PublishTrimmed=true -o ./publish | |
# Step 5: Zip the Windows publish folder | |
- 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 | |
- name: Upload Windows Build Artifact | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./publish/win64.zip | |
asset_name: win64.zip | |
asset_content_type: application/zip | |
# Linux Build Job | |
linux-build: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the code | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# Step 2: Set up .NET for Linux | |
- name: Set up .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '6.0.x' # Specify your .NET version | |
# Step 3: Restore dependencies | |
- name: Restore dependencies | |
run: dotnet restore | |
# Step 4: Publish the project as a single file for Linux 64-bit | |
- name: Publish the application (Linux) | |
run: dotnet publish -c Release -r linux-x64 -p:PublishSingleFile=true -p:PublishTrimmed=true -o ./publish | |
# Step 5: Copy the native library | |
- name: Copy libsteam_api.so to publish folder | |
run: cp ./NativeLibraries/linux64/libsteam_api.so ./publish/ | |
# Step 6: Zip the Linux publish folder | |
- name: Zip the Linux publish folder | |
run: zip -r ./publish/linux64.zip ./publish | |
# Step 7: Upload Linux build to release | |
- name: Upload Linux Build Artifact | |
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 | |
asset_name: linux64.zip | |
asset_content_type: application/zip |