Fix warnings. Fix build. #2
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 | |
on: | |
push: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Prepare version | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const script = require(require('path').resolve('./.github/workflows/version.js')) | |
const vs = script({ context, github, firstRev: '0eba8b1f' }); | |
let ver_str = vs.formatVersion('1.$(GitRevCount).$(RunNumber)-$(GitBranch) [$(GitSha6)/$(yyyy)-$(mm)-$(dd)]'); | |
let ver_suf = vs.formatVersion('$(GitBranch)'); | |
if (ver_suf == 'main') { | |
ver_str = ver_str.replace('-main', ''); | |
ver_suf = ''; | |
} | |
core.exportVariable('VER_STR', ver_str); | |
core.exportVariable('VER_NUM', vs.formatVersion('1.$(GitRevCount).$(RunNumber)')); | |
core.exportVariable('VER_SUF', ver_suf); | |
- name: Install dotnet | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '8.x' | |
dotnet-quality: 'ga' | |
- name: dotnet restore | |
run: dotnet restore | |
- name: dotnet test | |
run: dotnet test | |
- name: "dotnet pack: ${{ env.VER_STR }}" | |
run: dotnet pack Src\RT.Keyboard.csproj --configuration Release -p:InformationalVersion="${{env.VER_STR}}" -p:VersionPrefix=${{env.VER_NUM}} -p:VersionSuffix=${{env.VER_SUF}} -p:FileVersion=${{env.VER_NUM}} -p:AssemblyVersion=${{env.VER_NUM}} -o Publish | |
- name: Push to NuGet | |
run: dotnet nuget push Publish\*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: RT.Keyboard-v${{env.VER_NUM}} | |
path: Publish | |
if-no-files-found: error |