Workflow file for this run
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: | ||
workflow_call: | ||
inputs: | ||
dotnet_sdk_version: | ||
required: true | ||
type: string | ||
SETUP_NODE: | ||
required: false | ||
type: boolean | ||
default: true | ||
NPM_PACKAGE_SOURCE: | ||
description: 'Target in the format `//<registry-server/path>/`' | ||
required: false | ||
type: string | ||
NODE_VERSION: | ||
required: false | ||
type: string | ||
default: '20' | ||
ARTIFACTS_PATH: | ||
type: string | ||
default: artifacts/packages/ | ||
MORYX_COMMERCIAL_BUILD: | ||
required: false | ||
type: boolean | ||
default: true | ||
secrets: | ||
npm_auth_token: | ||
required: false | ||
myget_auth_token: | ||
required: false | ||
myget_user: | ||
required: false | ||
myget_pass: | ||
required: false | ||
outputs: | ||
artifacts_path: | ||
value: ${{ inputs.ARTIFACTS_PATH }} | ||
jobs: | ||
Build: | ||
runs-on: ubuntu-latest | ||
env: | ||
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages | ||
MORYX_COMMERCIAL_BUILD: ${{ inputs.MORYX_COMMERCIAL_BUILD }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/cache@v4 | ||
id: cache-nuget | ||
with: | ||
path: ${{ github.workspace }}/.nuget/packages | ||
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} | ||
restore-keys: | | ||
${{ runner.os }}-nuget- | ||
- name: 🔧 Setup Node version | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ inputs.NODE_VERSION }} | ||
if: ${{ inputs.SETUP_NODE == true }} | ||
- name: 🔧 Setup .NET SDK | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: ${{ inputs.dotnet_sdk_version }} | ||
- name: 🔧 Setup nuget | ||
uses: nuget/setup-nuget@v1 | ||
- name: 🗝️ Authenticate npm registry | ||
run: npm config set ${{ inputs.NPM_PACKAGE_SOURCE }}:_authToken ${{ secrets.npm_auth_token }} | ||
if: inputs.NPM_PACKAGE_SOURCE != '' | ||
- name: "🗝️ Authenticate MyGet" | ||
uses: moryx-industry/nuget-setapikey@v1 | ||
with: | ||
sources-file: './myget.feeds' | ||
api-key: ${{ secrets.myget_auth_token }} | ||
registry-user: ${{ secrets.myget_user }} | ||
registry-pass: ${{ secrets.myget_pass }} | ||
- name: Debug | ||
run: Write-Host $env:MORYX_COMMERCIAL_BUILD | ||
shell: pwsh | ||
- name: 🧰 Setup BuildToolkit | ||
uses: moryx-industry/setup-buildtoolkit@update/commercial-by-default | ||
- name: ♺ Execute nuget restore | ||
run: nuget restore | ||
if: steps.cache-nuget.outputs.cache-hit != 'true' | ||
- name: 🔨 Execute dotnet build | ||
run: | | ||
.\set-version.ps1 -RefName ${{ github.ref_name }} -IsTag ${{ github.ref_type == 'tag' && 1 || 0 }} -BuildNumber ${{ github.run_number }} -CommitHash ${{ github.sha }} | ||
.\build.ps1 -PackageSource ${{ github.workspace }}/.nuget/packages | ||
shell: pwsh | ||
- name: ⬆️ Upload package artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: build | ||
path: artifacts/build/ | ||
retention-days: 1 | ||
if-no-files-found: error | ||