nightly #73
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: nightly | |
on: | |
schedule: | |
- cron: "0 0 * * *" | |
workflow_dispatch: | |
inputs: | |
isMock: | |
description: "Replace with any word other than 'mock' to trigger a non-mock run." | |
default: "mock" | |
required: false | |
env: | |
CARGO_INCREMENTAL: 0 | |
CARGO_PROFILE_DEV_DEBUG: 0 | |
jobs: | |
# TODO: Add a pre-job check to skip if no change; may want to add something to check if there is a new rust version/week limit of skips? | |
initialize-job: | |
name: initialize-job | |
runs-on: ubuntu-latest | |
outputs: | |
should_run: ${{ steps.should_run.outputs.should_run }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
ref: dev | |
- name: print latest_commit | |
run: echo ${{ github.sha }} | |
- id: should_run | |
continue-on-error: true | |
name: check latest commit is less than a day | |
if: ${{ github.event_name == 'schedule' }} | |
run: | | |
echo "${{ github.event.inputs.isMock }}"; | |
if [[ -z "${{ github.event.inputs.isMock }}" ]]; then | |
echo "This is a scheduled nightly run." | |
test -z "$(git rev-list --after="24 hours" ${{ github.sha }})" && echo "::set-output name=should_run::false" | |
elif [[ "${{ github.event.inputs.isMock }}" == "mock" ]]; then | |
echo "This is a mock run." | |
else | |
echo "This is NOT a mock run. Watch for the generated files!" | |
fi | |
build-release: | |
needs: [initialize-job] | |
if: ${{ needs.initialize-job.outputs.should_run != 'false' }} | |
uses: ./.github/workflows/build_releases.yml | |
with: | |
branch: "dev" | |
secrets: inherit | |
upload-release: | |
name: upload-release | |
runs-on: ubuntu-latest | |
needs: [build-release] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Get release artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: release-* | |
path: release | |
merge-multiple: true | |
- name: Print out all release files | |
run: | | |
echo "Generated $(ls ./release | wc -l) files:" | |
du -h -d 0 ./release/* | |
- name: Delete tag and release if not mock | |
if: github.event.inputs.isMock != 'mock' | |
run: gh release delete nightly --cleanup-tag | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Sleep for a few seconds to prevent timing issues between the deletion and creation of the release | |
run: sleep 10 | |
if: github.event.inputs.isMock != 'mock' | |
- name: Add all release files and create nightly release if not mock | |
uses: softprops/[email protected] | |
if: github.event.inputs.isMock != 'mock' | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
prerelease: true | |
tag_name: "nightly" | |
draft: false | |
fail_on_unmatched_files: true | |
files: | | |
./release/* |