bottom/.github/workflows/nightly.yml

101 lines
3 KiB
YAML

# Creates nightly deployment builds for main targets. Note this does not cover package distribution channels,
# such as choco.
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
CARGO_HUSKY_DONT_INSTALL_HOOKS: true
jobs:
# Check if things should be skipped.
pre-job:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- name: Check if this action should be skipped
id: skip_check
uses: fkirc/skip-duplicate-actions@f75f66ce1886f00957d99748a42c724f4330bdcf # v5.3.1
with:
skip_after_successful_duplicate: "true"
do_not_skip: '["workflow_dispatch"]'
initialize-job:
name: initialize-job
needs: pre-job
if: ${{ needs.pre-job.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
steps:
- name: Check if mock
run: |
echo "${{ github.event.inputs.isMock }}";
if [[ -z "${{ github.event.inputs.isMock }}" ]]; then
echo "This is a scheduled nightly run."
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
uses: ./.github/workflows/build_releases.yml
with:
caller: "nightly"
secrets: inherit
upload-release:
name: upload-release
needs: build-release
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 1
- name: Get release artifacts
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
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/action-gh-release@20e085ccc73308c2c8e43ab8da4f8d7ecbb94d4e # 2.0.1
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/*