mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-08-20 10:12:41 +08:00
while nightly builds are useful they also cause a large amount of spam on the main project nuget. here we try to change the package id so that it will be hosted as a separate package while having all the same code and namespaces this means people can opt into the nightly builds while keeping the version history of the released package tidy. no idea if this will work because actions and yaml is my idea of hell and is impossible to debug, but let's give it a go
58 lines
1.9 KiB
YAML
58 lines
1.9 KiB
YAML
name: Nightly Release
|
|
|
|
on:
|
|
schedule:
|
|
- cron: "0 0 * * *"
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
tests:
|
|
uses: ./.github/workflows/run_integration_tests.yml
|
|
check_date:
|
|
runs-on: ubuntu-latest
|
|
name: Check latest commit
|
|
outputs:
|
|
should_run: ${{ steps.should_run.outputs.should_run }}
|
|
steps:
|
|
- uses: actions/checkout@master
|
|
- name: print latest_commit
|
|
run: echo ${{ github.sha }}
|
|
|
|
- id: should_run
|
|
continue-on-error: true
|
|
name: check latest commit is less than a day ago
|
|
if: ${{ github.event_name == 'schedule' }}
|
|
run: test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo "::set-output name=should_run::false"
|
|
build_and_publish_nightly:
|
|
needs: [check_date, tests]
|
|
if: ${{ needs.check_date.outputs.should_run != 'false' }}
|
|
runs-on: windows-2019
|
|
name: build_and_publish_nightly
|
|
steps:
|
|
- uses: actions/checkout@master
|
|
|
|
- name: Set up dotnet core
|
|
uses: actions/setup-dotnet@v2
|
|
with:
|
|
dotnet-version: |
|
|
2.1.x
|
|
6.0.x
|
|
|
|
- name: Add msbuild to PATH
|
|
uses: microsoft/setup-msbuild@v1.0.2
|
|
|
|
- name: Write nightly version to projects
|
|
run: |
|
|
$newVer = .\tools\generate-nightly-version.ps1; .\tools\set-version.ps1 $newVer; .\tool\set-package-nightly.ps1
|
|
|
|
- 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
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|