Fix CI: remove suffix for default branch and fix deprecation warnings. #3
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: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Prepare version | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const script = require(require('path').resolve('./.github/workflows/version.js')) | |
const vs = script({ context, github, firstRev: 'cfefc91c' }); | |
const majmin = '1.1'; | |
let ver_str = vs.formatVersion(`${majmin}.$(GitRevCount)-$(GitBranch) [$(GitSha6)/$(yyyy)-$(mm)-$(dd)]`); | |
let ver_suf = vs.formatVersion('$(GitBranch)'); | |
if (ver_suf == 'master') { | |
ver_str = ver_str.replace('-master', ''); | |
ver_suf = ''; | |
} | |
core.exportVariable('VER_STR', ver_str); | |
core.exportVariable('VER_NUM', vs.formatVersion(`${majmin}.$(GitRevCount)`)); | |
core.exportVariable('VER_SUF', ver_suf); | |
- name: Install dotnet | |
uses: actions/setup-dotnet@v4 | |
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.Servers.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@v4 | |
with: | |
name: RT.Servers-v${{env.VER_NUM}} | |
path: Publish | |
if-no-files-found: error |