Skip to content

Fix project references #75

Fix project references

Fix project references #75

name: 'Build and Publish'
on:
workflow_dispatch:
push:
branches:
- dev
- future
- release/*
tags:
- v[0-9]+.[0-9]+.[0-9]+
pull_request:
branches:
- dev
- future
- release/*
env:
dotnet_sdk_version: '8.0.300'
jobs:
Variables:
runs-on: ubuntu-latest
steps:
- name: Set Release variables
id: set-variables
run: |
if [[ ${{ github.ref_name }} =~ v[0-9]+.[0-9]+.[0-9]+ ]]; then
echo "MORYX_PACKAGE_TARGET=https://www.myget.org/F/moryx/api/v2/package" >> $GITHUB_OUTPUT
echo "MORYX_PACKAGE_TARGET_V3=https://www.myget.org/F/moryx/api/v3/index.json" >> $GITHUB_OUTPUT
echo "NPM_PACKAGE_SOURCE=//www.myget.org/F/moryx-ci/npm/" >> $GITHUB_OUTPUT
else
echo "MORYX_PACKAGE_TARGET=https://www.myget.org/F/moryx-ci/api/v2/package" >> $GITHUB_OUTPUT
echo "MORYX_PACKAGE_TARGET_V3=https://www.myget.org/F/moryx-ci/api/v3/index.json" >> $GITHUB_OUTPUT
echo "NPM_PACKAGE_SOURCE=//www.myget.org/F/moryx-ci/npm/" >> $GITHUB_OUTPUT
fi
outputs:
dotnet_sdk_version: ${{ env.dotnet_sdk_version }}
MORYX_PACKAGE_TARGET: ${{ steps.set-variables.outputs.MORYX_PACKAGE_TARGET }}
MORYX_PACKAGE_TARGET_V3: ${{ steps.set-variables.outputs.MORYX_PACKAGE_TARGET_V3 }}
NPM_PACKAGE_SOURCE: ${{ steps.set-variables.outputs.NPM_PACKAGE_SOURCE }}
Tests:
needs: [Variables]
uses: moryx-industry/tools/.github/workflows/run-tests.yml@v1
with:
dotnet_sdk_version: ${{ needs.Variables.outputs.dotnet_sdk_version }}
npm_package_source: ${{ needs.Variables.outputs.NPM_PACKAGE_SOURCE }}
secrets:
npm_auth_token: ${{ secrets.MYGET_TOKEN }}
myget_auth_token: ${{ secrets.MYGET_TOKEN }}
myget_user: ${{ secrets.MYGET_USER }}
myget_pass: ${{ secrets.MYGET_PASS }}
Build-Publish:
needs: [Variables, Tests]
runs-on: ubuntu-latest
env:
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
MORYX_COMMERCIAL_BUILD: true
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 .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ needs.Variables.outputs.dotnet_sdk_version }}
- name: 🧰 Setup BuildToolkit
uses: moryx-industry/setup-buildtoolkit@v1
- name: β™Ί Execute nuget restore
run: dotnet 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: Copy artifacts
run: cp -r artifacts/build artifacts/Licensing
if: ${{ github.ref_name == 'dev' || github.ref_name == 'future' || (startsWith(github.ref, 'refs/tags/v')) }}
- name: πŸ“¦ Create Packages and 🚚 deliver
run: |
.\set-version.ps1 -RefName ${{ github.ref_name }} -IsTag ${{ github.ref_type == 'tag' && 1 || 0 }} -BuildNumber ${{ github.run_number }} -CommitHash ${{ github.sha }}
.\pack-publish.ps1 -NugetApiKey ${{ secrets.MYGET_TOKEN }} -PackageTarget ${{ needs.Variables.outputs.MORYX_PACKAGE_TARGET }}
shell: pwsh
if: ${{ github.ref_name == 'dev' || github.ref_name == 'future' || (startsWith(github.ref, 'refs/tags/v')) }}
- name: ⬆️ Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: packages
path: artifacts/packages/
if: ${{ github.ref_name == 'dev' || github.ref_name == 'future' || (startsWith(github.ref, 'refs/tags/v')) }}
Create-Reports:
needs: [Build-Publish]
uses: moryx-industry/tools/.github/workflows/create-test-report.yml@v1
if: ${{ github.ref_name == 'dev' || github.ref_name == 'future' || (startsWith(github.ref, 'refs/tags/v')) }}
Publish-Reports:
needs: [Create-Reports]
uses: moryx-industry/tools/.github/workflows/publish-test-coverage.yml@v1
secrets:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}