Improved resilience of schema generation #179
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 and release | |
on: | |
push: | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+' | |
- 'v[0-9]+.[0-9]+.[0-9]+-[a-z]+.[0-9]+' | |
branches: [ '*/main', '*/dev' ] | |
pull_request: | |
branches: [ '*/main', '*/dev' ] | |
env: | |
PKG_VERSION: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || null }} | |
NODE_VERSION: 20 | |
DOTNET_VERSION: 8.x | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set version | |
if: ${{ !env.PKG_VERSION }} | |
run: | | |
calculatedSha=$(git rev-parse --short ${{ github.sha }}) | |
echo "PKG_VERSION=0.0.0-preview.${{github.run_number}}.$calculatedSha" >> $GITHUB_ENV | |
- name: Setup npm | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{env.NODE_VERSION}} | |
cache: 'npm' | |
cache-dependency-path: '**/package-lock.json' | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: ${{env.DOTNET_VERSION}} | |
- name: Build project | |
run: dotnet build src/UmbracoDeliveryApiExtensions | |
-c Release | |
/p:ContinuousIntegrationBuild=true | |
/p:Version=${PKG_VERSION#v} | |
- name: Upload package as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artifact | |
if-no-files-found: error | |
path: | | |
**/*.nupkg | |
**/*.snupkg | |
tests: | |
name: Tests | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup npm | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{env.NODE_VERSION}} | |
cache: 'npm' | |
cache-dependency-path: '**/package-lock.json' | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: ${{env.DOTNET_VERSION}} | |
- name: Run Test website | |
env: | |
LANG: en_US.UTF-8 | |
run: | | |
timeout 300 grep -q 'uSync: Startup Complete' <(dotnet run --project tests/UmbracoDeliveryApiExtensions.TestSite --launch-profile CI | tee -p /dev/fd/2) | |
- name: Install packages | |
working-directory: tests | |
run: | | |
find . -maxdepth 3 -name package.json -execdir npm ci \; | |
- name: Run Orval client | |
working-directory: tests/clients/orval | |
run: | | |
npm run start | |
- name: Run openapi-typescript client | |
working-directory: tests/clients/openapi-typescript | |
run: | | |
npm run start | |
- name: Run NSwag client | |
working-directory: tests/clients/nswag | |
run: dotnet run -c Release | |
- name: Run Playwright tests | |
working-directory: tests/UmbracoDeliveryApiExtensions.Playwright | |
run: | | |
npm run test | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
needs: [build, tests] | |
steps: | |
- name: Download artifact from build | |
uses: actions/download-artifact@v4 | |
with: | |
name: artifact | |
- name: Push to NuGet | |
run: dotnet nuget push **/*.nupkg --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json |