Merge pull request #4 from Duinrahaic/development #9
Workflow file for this run
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: Build and Deploy FitOSC (Windows) - Runtime and No Runtime | |
on: | |
push: | |
tags: | |
- 'v*.*.*' # Trigger on version tag pushes | |
workflow_dispatch: # Enables manual triggering | |
jobs: | |
build: | |
runs-on: windows-latest # Use Windows runner | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '8.0.x' # Adjust based on the .NET version you are using | |
# Build without runtime (Framework-dependent) | |
- name: Build FitOSC without runtime (Framework-dependent) | |
working-directory: ./FitOSC | |
run: dotnet publish --configuration Release --output ./output/no-runtime --no-self-contained --runtime win-x64 | |
# Build with runtime (Self-contained, will create .exe) | |
- name: Build FitOSC with runtime (Self-contained) | |
working-directory: ./FitOSC | |
run: dotnet publish --configuration Release --output ./output/with-runtime --self-contained --runtime win-x64 | |
- name: Upload release artifact (without runtime) | |
uses: actions/upload-artifact@v3 | |
with: | |
name: fitosc-no-runtime # Name the artifact for no-runtime version | |
path: ./FitOSC/output/no-runtime # Path to no-runtime build | |
- name: Upload release artifact (with runtime) | |
uses: actions/upload-artifact@v3 | |
with: | |
name: fitosc-with-runtime # Name the artifact for the runtime version (contains .exe) | |
path: ./FitOSC/output/with-runtime # Path to runtime build (contains .exe) | |
deploy: | |
needs: build | |
runs-on: windows-latest # Ensure deploy job also runs on Windows | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Extract Tag | |
id: extract_tag | |
run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV # Extract tag and set as env var | |
- name: Download artifact (without runtime) | |
uses: actions/download-artifact@v3 | |
with: | |
name: fitosc-no-runtime | |
path: ./FitOSC/output/no-runtime | |
- name: Download artifact (with runtime) | |
uses: actions/download-artifact@v3 | |
with: | |
name: fitosc-with-runtime | |
path: ./FitOSC/output/with-runtime | |
- name: Zip framework-dependent build (without runtime) | |
run: | | |
cd ./FitOSC/output/no-runtime | |
tar -czf ../../fitosc-no-runtime.zip * # Create a zip archive of the folder contents | |
- name: Zip self-contained build (with runtime) | |
run: | | |
cd ./FitOSC/output/with-runtime | |
tar -czf ../../fitosc-with-runtime.zip * # Create a zip archive of the folder contents | |
- name: Create GitHub Release | |
uses: ncipollo/release-action@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} # Use the GitHub Token or PAT | |
tag: ${{ env.TAG }} # Use the extracted tag | |
name: Release ${{ env.TAG }} # Use the extracted tag for release name | |
body: | | |
Release notes for FitOSC version ${{ env.TAG }} | |
- **Without runtime**: Framework-dependent deployment. | |
- **With runtime**: Self-contained deployment (includes .exe). | |
draft: false | |
prerelease: false | |
assets: | | |
./fitosc-no-runtime.zip # Zip file for framework-dependent build | |
./fitosc-with-runtime.zip # Zip file for self-contained build | |