Skip to content

Merge branch 'cicd' #347

Merge branch 'cicd'

Merge branch 'cicd' #347

Workflow file for this run

name: Linux
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
get-version:
name: Calculating Version Suffix
runs-on: ubuntu-22.04
outputs:
version_suffix: ${{ steps.set-vars.outputs.version_suffix }}
steps:
- uses: actions/checkout@v4
- id: git-vars
name: Get git branch information
shell: bash
run: |
echo "##[set-output name=git_branch;]$(echo $GITHUB_REF)"
echo "::set-output name=git_hash::$(git rev-parse --short HEAD)"
- id: set-vars
uses: actions/github-script@v7
with:
script: |
let runNumber = "${{ github.run_number }}";
let gitHash = "${{ steps.git-vars.outputs.git_hash }}";
let rawGitRef = "${{ steps.git-vars.outputs.git_branch }}";
console.log("rawGitRef: " + rawGitRef);
let gitRef = rawGitRef.replace(/^refs\/heads\//, "").replace(/^refs\/heads\//, "").replace(/[_//!@#$%&]/g, "-");
if(gitRef.indexOf("refs/pull/") === 0) {
gitRef = "pr-" + gitRef.substring(10, gitRef.lastIndexOf("/"));
}
var versSuffix = `${gitRef}.${runNumber}+${gitHash}`;
console.log("Final computed version suffix: " + versSuffix);
core.setOutput("version_suffix", versSuffix);
build:
name: Build and Test
runs-on: ubuntu-22.04
needs: [get-version]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup .NET Sdk
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
- name: Get Installed .NET Information
run: dotnet --info
- name: Install dependencies
run: dotnet restore --property:VersionSuffix=${{needs.get-version.outputs.version_suffix}}
- name: Build
run: dotnet build --configuration Release --no-restore --property:VersionSuffix=${{needs.get-version.outputs.version_suffix}}
- name: Test
run: dotnet test --no-restore --verbosity minimal --property:VersionSuffix=${{needs.get-version.outputs.version_suffix}}
- name: Push to NuGet Nightly
env:
NIGHTLY_NUGET_SOURCE: ${{ secrets.NIGHTLY_NUGET_SOURCE }}
NIGHTLY_NUGET_API_KEY: ${{ secrets.NIGHTLY_NUGET_API_KEY }}
if: ${{github.ref == 'refs/heads/master' && env.NIGHTLY_NUGET_SOURCE != '' && env.NIGHTLY_NUGET_API_KEY != '' }}
run: dotnet nuget push "./artifacts/**/*.nupkg" -k ${{env.NIGHTLY_NUGET_API_KEY}} -s ${{env.NIGHTLY_NUGET_SOURCE}} --skip-duplicate