Update main.yml #10
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: .NET Desktop CI | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
permissions: # Add this section to specify permissions for the GITHUB_TOKEN | |
contents: write | |
jobs: | |
build-and-test: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '8.0.x' # Replace with the .NET version your project targets | |
- name: Build Solution | |
run: dotnet build --configuration Release | |
- name: Run Tests | |
run: dotnet test | |
- name: Publish Application | |
run: dotnet publish --configuration Release -o ./publish -p:PublishSingleFile=true | |
- name: Upload Published App as Artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: published-app | |
path: ./publish/** | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./publish/DeFRaG_Helper.exe # Replace with the path to your single file application | |
asset_name: DeFRaG_Helper.exe # Replace with the name of your single file application | |
asset_content_type: application/octet-stream |