Nightly Release #1180
This file contains hidden or 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: Nightly Release | |
| on: | |
| schedule: | |
| - cron: "0 0 * * *" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write # Grant write permission for tagging | |
| jobs: | |
| check_publish_needed: | |
| runs-on: ubuntu-latest | |
| name: Check if this commit has already been published | |
| outputs: | |
| should_run: ${{ steps.check.outputs.should_run }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Fetch tags | |
| run: git fetch --tags | |
| - id: check | |
| run: | | |
| latest_commit=$(git rev-parse nightly-latest || echo "") | |
| echo "Latest published commit: $latest_commit" | |
| if [ "$latest_commit" = "${{ github.sha }}" ]; then | |
| echo "No new commit since last publish." | |
| echo "should_run=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "New commit detected." | |
| echo "should_run=true" >> $GITHUB_OUTPUT | |
| fi | |
| tests: | |
| needs: check_publish_needed | |
| if: ${{ needs.check_publish_needed.outputs.should_run == 'true' }} | |
| uses: ./.github/workflows/run_integration_tests.yml | |
| build_and_publish_nightly: | |
| needs: [check_publish_needed, tests] | |
| if: ${{ needs.check_publish_needed.outputs.should_run == 'true' }} | |
| runs-on: windows-2022 | |
| name: build_and_publish_nightly | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up dotnet core | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: | | |
| 2.1.x | |
| 6.0.x | |
| 8.0.x | |
| 9.0.x | |
| - name: Add msbuild to PATH | |
| uses: microsoft/[email protected] | |
| - name: Write nightly version to projects | |
| run: | | |
| $newVer = .\tools\generate-nightly-version.ps1; .\tools\set-version.ps1 $newVer | |
| - name: Restore packages | |
| run: dotnet restore tools/UglyToad.PdfPig.Package/UglyToad.PdfPig.Package.csproj | |
| - name: Build package | |
| run: dotnet pack -c Release -o package tools/UglyToad.PdfPig.Package/UglyToad.PdfPig.Package.csproj -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg | |
| - name: Publish Nuget to GitHub registry | |
| run: dotnet nuget push **/*.nupkg --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json | |
| - name: Tag latest nightly commit | |
| run: | | |
| git config user.name "github-actions" | |
| git config user.email "[email protected]" | |
| git tag -f nightly-latest ${{ github.sha }} | |
| git push origin nightly-latest --force |