This repository has been archived by the owner on Sep 23, 2024. It is now read-only.
nightly #284
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 | |
# 0 7 is 1 AM CST | |
on: | |
schedule: | |
- cron: '0 7 * * *' | |
# Cancel in-progress/pending daily release workflows if a new one starts. | |
# When we merge PRs one after another quickly, we only need one release with the latest code. | |
concurrency: | |
group: ${{ github.workflow }} | |
cancel-in-progress: true | |
jobs: | |
# Check if the latest commit was within the last 24 hours | |
# https://github.com/orgs/community/discussions/27128 | |
check_date: | |
runs-on: ubuntu-latest | |
name: Check latest commit | |
outputs: | |
should_run: ${{ steps.should_run.outputs.should_run }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: print latest_commit | |
run: echo ${{ github.sha }} | |
- id: should_run | |
continue-on-error: true | |
name: check latest commit is less than a day old | |
run: test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo "should_run=false" >> "$GITHUB_OUTPUT" | |
release: | |
needs: check_date | |
if: ${{ needs.check_date.outputs.should_run != 'false' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
# Using 'temurin' speeds up the job, because this distribution is cached by the runner. | |
# See: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Hosted-Tool-Cache | |
- name: Set up Gradle | |
uses: gradle/gradle-build-action@v3 | |
- name: Set up Homebrew | |
run: .github/workflows/setup-homebrew.sh | |
- name: Set up Ruby | |
run: .github/workflows/setup-ruby.sh | |
- name: Decrypt secrets | |
env: | |
GPG_KEY: ${{ secrets.gpg_key }} | |
run: ./decrypt.sh | |
working-directory: ./secrets | |
- name: Build and release | |
env: | |
GRADLE_OPTS: -Dorg.gradle.daemon=false | |
run: ci/nightly-release.sh ${{ github.run_number }} ${{ secrets.GITHUB_TOKEN }} |