Skip to content

Update dotnet.yml

Update dotnet.yml #51

Workflow file for this run

# This workflow will build and release a .NET project
name: Build & Release
# Run the workflow after changes in the "master" branch
on:
push:
branches: [ "master" ]
jobs:
build_and_release:
# Use "windows-2019" runner for .NET Framework 4.x projects and "windows-latest" for .NET Core projects
runs-on: windows-2019
# Define env variables containing project properties
# Use TIMT (The-Infinite-Monkey-Theorem) prefix for variable names
env:
TIMT_PROJECT_NAME: 'Snaffler'
TIMT_SOLUTION_FILE: 'Snaffler.sln'
TIMT_BINARY_PATH: '${{ github.workspace }}\Snaffler\bin\Release'
TIMT_BINARY_FILE: '${{ github.workspace }}\Snaffler\bin\Release\Snaffler.exe'
steps:

Check failure on line 25 in .github/workflows/dotnet.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/dotnet.yml

Invalid workflow file

You have an error in your yaml syntax on line 25
- uses: actions/checkout@v3
- name: Install NuGet
uses: NuGet/setup-nuget@v1.2.0
- name: Restore
run: nuget restore $env:TIMT_SOLUTION_FILE
- name: Install MSBuild
uses: microsoft/setup-msbuild@v1.1
- name: Build
run: msbuild $env:TIMT_SOLUTION_FILE -t:rebuild -property:Configuration=Release
# Get release version as a combination of the project assembly version and the GitHub build number
- name: Get Release Version
id: get_release_version
run: |
$assembly = [System.Reflection.Assembly]::LoadFile("$env:TIMT_BINARY_FILE")
$version = $assembly.GetName().Version.ToString() + '-' + '${{ github.run_number }}'
echo "::set-output name=version::$version"
shell: powershell
# Create ZIP file containing project binaries
- name: Create Zip
id: create_zip
run: |
Compress-Archive -Path "$env:TIMT_BINARY_PATH\*" -DestinationPath ".\$env:TIMT_PROJECT_NAME.zip"
echo "::set-output name=assetFilename::$env:TIMT_PROJECT_NAME.zip"
shell: powershell
# Create new project release
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.get_release_version.outputs.version }}
release_name: ${{ env.TIMT_PROJECT_NAME }} v${{ steps.get_release_version.outputs.version }}
draft: false
prerelease: false
# Attach ZIP file containing project binaries to the release
- 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: ${{ steps.create_zip.outputs.assetFilename }}
asset_name: ${{ env.TIMT_PROJECT_NAME }}-v${{ steps.get_release_version.outputs.version }}.zip
asset_content_type: application/zip