diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d30d24d..08b8963 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,7 +20,7 @@ jobs: submodules: true # tests/JSON-Schema-Test-Suite - name: Install Dotnet - uses: actions/setup-dotnet@9a946fdbd5fb07b82b2f5a4466058b876ab72bb2 # v5.3.0 + uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0 with: global-json-file: global.json diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d8692e1..f0fac7a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,54 +1,54 @@ -# On pushing a tag like v0.1.0, publish to nuget.org and create a GitHub release. -# Use publish-release.ps1 to push a release. -name: release - -on: - push: - tags: - - "v[0-9]+.*" # not a regex! ".*" means a period followed by any character https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet - -permissions: - contents: write # needed to create the GitHub release - -jobs: - build: - - runs-on: windows-latest - - steps: - - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 - - - name: Install Dotnet - uses: actions/setup-dotnet@9a946fdbd5fb07b82b2f5a4466058b876ab72bb2 # v5.3.0 - with: - global-json-file: global.json - - - name: Dotnet Installation Info - run: dotnet --info - - - name: Pack - run: dotnet pack ./src/JsonSchemaObjectModel/JsonSchemaObjectModel.csproj -c Release -p:ContinuousIntegrationBuild=true - - - name: Publish to NuGet - run: dotnet nuget push --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }} --source 'https://api.nuget.org/v3/index.json' .\src\JsonSchemaObjectModel\bin\Release\JsonSchemaObjectModel.*.nupkg - - # Pull the notes for this version straight out of CHANGELOG.md so the GitHub release - # mirrors what's already curated there (CHANGELOG.md is the single source of truth). - - name: Extract release notes from CHANGELOG - shell: pwsh - run: | - $version = '${{ github.ref_name }}'.TrimStart('v') - $changelog = Get-Content -Raw CHANGELOG.md - $escaped = [regex]::Escape($version) - $match = [regex]::Match($changelog, "(?ms)^# Release $escaped[ \t]*\r?\n(.*?)(?=\r?\n# Release |\z)") - if (-not $match.Success) { - Write-Error "Could not find a '# Release $version' section in CHANGELOG.md" - exit 1 - } - Set-Content -Path release-notes.md -Value $match.Groups[1].Value.Trim() - - - name: Create GitHub release - shell: pwsh - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: gh release create "${{ github.ref_name }}" --title "${{ github.ref_name }}" --notes-file release-notes.md --verify-tag +# On pushing a tag like v0.1.0, publish to nuget.org and create a GitHub release. +# Use publish-release.ps1 to push a release. +name: release + +on: + push: + tags: + - "v[0-9]+.*" # not a regex! ".*" means a period followed by any character https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet + +permissions: + contents: write # needed to create the GitHub release + +jobs: + build: + + runs-on: windows-latest + + steps: + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + + - name: Install Dotnet + uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0 + with: + global-json-file: global.json + + - name: Dotnet Installation Info + run: dotnet --info + + - name: Pack + run: dotnet pack ./src/JsonSchemaObjectModel/JsonSchemaObjectModel.csproj -c Release -p:ContinuousIntegrationBuild=true + + - name: Publish to NuGet + run: dotnet nuget push --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }} --source 'https://api.nuget.org/v3/index.json' .\src\JsonSchemaObjectModel\bin\Release\JsonSchemaObjectModel.*.nupkg + + # Pull the notes for this version straight out of CHANGELOG.md so the GitHub release + # mirrors what's already curated there (CHANGELOG.md is the single source of truth). + - name: Extract release notes from CHANGELOG + shell: pwsh + run: | + $version = '${{ github.ref_name }}'.TrimStart('v') + $changelog = Get-Content -Raw CHANGELOG.md + $escaped = [regex]::Escape($version) + $match = [regex]::Match($changelog, "(?ms)^# Release $escaped[ \t]*\r?\n(.*?)(?=\r?\n# Release |\z)") + if (-not $match.Success) { + Write-Error "Could not find a '# Release $version' section in CHANGELOG.md" + exit 1 + } + Set-Content -Path release-notes.md -Value $match.Groups[1].Value.Trim() + + - name: Create GitHub release + shell: pwsh + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: gh release create "${{ github.ref_name }}" --title "${{ github.ref_name }}" --notes-file release-notes.md --verify-tag