Skip to content

Publish

Publish #8

Workflow file for this run

name: Publish
on:
release:
types: [published]
env:
# Path to the solution file relative to the root of the project.
SOLUTION_FILE_PATH: MobiFlightConnector.sln
# Configuration type to build.
# You can convert this to a build matrix if you need coverage of multiple configuration types.
# https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
BUILD_CONFIGURATION: Release
BUILD_PLATFORM: x86
PROJECT_TEST: MobiFlightUnitTests
PROJECT_MAIN: MobiFlightConnector
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Add MSBuild to PATH
uses: microsoft/[email protected]
- name: Add VSTest to Path
uses: darenm/Setup-VSTest@v1
- name: Downgrade NSIS
shell: pwsh
run: .\Build\downgrade_nsis.ps1
- name: Replace version in AssemblyInfo.cs
run: (Get-Content "Properties/AssemblyInfo.cs") -replace '\("\d+\.\d+\.\d+(\.\d+)?"\)', '("${{ github.event.release.tag_name }}")' | Out-File "Properties/AssemblyInfo.cs"
shell: pwsh
- name: Dump AssemblyInfo.cs
run: 'type Properties/AssemblyInfo.cs'
shell: pwsh
- name: Restore NuGet packages
working-directory: ${{env.GITHUB_WORKSPACE}}
run: nuget restore ${{env.SOLUTION_FILE_PATH}}
- name: Build Test
working-directory: ${{env.GITHUB_WORKSPACE}}
# Add additional options to the MSBuild command line here (like platform or verbosity level).
# See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference
run: msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=${{env.BUILD_PLATFORM}} /t:${{env.PROJECT_TEST}} ${{env.SOLUTION_FILE_PATH}}
- name: Run Tests
run: vstest.console.exe ${{env.PROJECT_TEST}}/bin/Release/${{env.PROJECT_TEST}}.dll
- name: Build Connector
working-directory: ${{env.GITHUB_WORKSPACE}}
# Add additional options to the MSBuild command line here (like platform or verbosity level).
# See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference
run: msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=${{env.BUILD_PLATFORM}} ${{env.SOLUTION_FILE_PATH}} /t:${{env.PROJECT_MAIN}}
- name: Create Hash
run: (Get-FileHash Release/MobiFlightConnector-${{ github.event.release.tag_name }}.zip -Algorithm SHA1).Hash | Out-File Release/MobiFlightConnector-${{ github.event.release.tag_name }}.sha1
shell: pwsh
- name: Create latest setup exe
uses: joncloud/makensis-action@v4
with:
script-file: ./Build/setup.nsi
arguments: "/V3"
- name: Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
Release/*.zip
Release/*.sha1
- name: store latest setup file
uses: actions/upload-artifact@v3
with:
name: MobiFlight-Setup
path: |
Build/MobiFlight-Setup.exe