Update dotnet-desktop.yml #81
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
# This workflow will build and test a Windows Forms desktop application | |
# built on .NET Core. | |
name: .NET Core Desktop | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
CONFIGURATION: 'Release' | |
jobs: | |
build: | |
name: Build project | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.ref }} | |
- name: Set Build number | |
run: echo "BUILD_ID=${{ github.ref_name }}_$(date +'%Y%j').${{github.run_attempt}}" >> "$env:GITHUB_ENV" | |
# Install the .NET Core workload | |
- name: Install .NET Core | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
# Build the application | |
- name: Build the application | |
run: dotnet build --configuration ${{ env.Configuration }} | |
# Zip the application | |
- name: Check | |
run: env | |
- name: Zip project | |
uses: thedoctor0/zip-release@master | |
with: | |
directory: ./src/UI/bin/${{ env.Configuration }}/net8.0-windows/ | |
filename: NDifference.zip | |
- name: 🚀 Upload Build Artifacts | |
id: upload-artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: NDifference | |
path: ./src/UI/bin/${{ env.Configuration }}/net8.0-windows/NDifference.zip | |
if-no-files-found: error | |
release: | |
name: Release project | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: NDifference | |
- name: Check | |
run: env | |
- name: 🚀 Create Release | |
id: create-release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.BUILD_ID }} | |
release_name: ${{ env.BUILD_ID }} | |
draft: false | |
- name: Upload Release | |
id: upload-release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create-release.outputs.upload_url }} | |
asset_path: NDifference.zip | |
asset_name: NDifference-${{ github.ref }}.zip | |
asset_content_type: application/zip | |