Publish nightly #836
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: 'Publish nightly' | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 2 * * *' # run at 2 AM UTC | |
jobs: | |
check: | |
continue-on-error: true | |
runs-on: windows-latest | |
outputs: | |
status: ${{ join(steps.*.conclusion) }} | |
steps: | |
- id: clone-repo | |
name: Clone the repo | |
uses: actions/checkout@v2 | |
- id: commits-happened | |
name: Check if commits happened in the last 72 hours | |
run: | | |
if([string]::IsNullOrWhitespace((git log ${GITHUB_REF##*/} --since="72 hours ago") -join '')) { | |
Echo "No recent commits, skipping nightly build" | |
Exit 1 | |
} | |
deployment: | |
runs-on: windows-latest | |
needs: check | |
if: "!contains(needs.check.outputs.status, 'failure')" | |
steps: | |
- name: Clone the repo | |
uses: actions/checkout@v2 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '6.0.101' | |
- name: Get current time | |
uses: 1466587594/get-current-time@v2 | |
id: current-time | |
with: | |
format: Y.M.D-H.m.s | |
- name: Build and package | |
run: dotnet build Sources/Yoakke.sln --configuration Release /p:VersionPrefix=${{ steps.current-time.outputs.formattedTime }} /p:VersionSuffix=nightly /p:PackageReleaseNotes="Nightly build" | |
- name: Clean up NuGet.org packages | |
run: dotnet run --project Sources/Tools/NugetMaintainer/NugetMaintainer.csproj -- --local-root Sources --prefix Yoakke --owner LanguageDev --api-key ${{ secrets.NUGET_TOKEN }} --nightly-suffix nightly --timestamp ${{ steps.current-time.outputs.formattedTime }} --timestamp-format yyyy.M.d-H.m.s- --lookbehind-days 3 --delay-between-requests 15 | |
- name: Upload to NuGet.org | |
run: dotnet nuget push Sources/**/*${{ steps.current-time.outputs.formattedTime }}-nightly.nupkg --api-key ${{ secrets.NUGET_TOKEN }} --source https://api.nuget.org/v3/index.json --no-symbols true |