cd: optimize nightly

Add check to only run nightly if changes in the past 24 hours
This commit is contained in:
Zane Schepke 2024-09-19 16:31:37 -04:00
parent e58dad00ea
commit 230f505806
5 changed files with 45 additions and 9 deletions

20
.github/workflows/check-date.yml vendored Normal file
View File

@ -0,0 +1,20 @@
name: check-date
on:
workflow_dispatch:
jobs:
check_date:
runs-on: ubuntu-latest
name: Check latest commit
outputs:
should_run: ${{ steps.should_run.outputs.should_run }}
steps:
- uses: actions/checkout@v2
- 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: test -z $(git rev-list --after="23 hours" ${{ github.sha }}) && echo "::set-output name=should_run::false"

17
.github/workflows/nightly.yml vendored Normal file
View File

@ -0,0 +1,17 @@
name: nightly
on:
schedule:
- cron: "4 3 * * *"
jobs:
nightly-publish-check:
name: Nightly publish check
runs-on: ubuntu-latest
needs: check_date
if: ${{ needs.check_date.outputs.should_run != 'false' }}
steps:
- name: Build and publish nightly
uses: ./.github/workflows/release.yml
secrets: inherit
with:
build_type: ${{ inputs.release_type == '' && 'nightly' || inputs.release_type }}

View File

@ -1,4 +1,4 @@
name: Issue Updates Workflow
name: on-issue
on:
issues:
@ -7,8 +7,8 @@ on:
jobs:
build:
name: Build
on-issue:
name: On new issue
runs-on: ubuntu-latest
steps:
- name: Send Telegram Message

View File

@ -1,4 +1,4 @@
name: Release Updates Workflow
name: on-publish
on:
release:
@ -7,8 +7,8 @@ on:
jobs:
build:
name: Build
on-publish:
name: On publish
runs-on: ubuntu-latest
steps:
- name: Send Telegram Message

View File

@ -1,8 +1,6 @@
name: release-android
on:
schedule:
- cron: "4 3 * * *"
workflow_dispatch:
inputs:
track:
@ -34,7 +32,8 @@ on:
jobs:
build:
name: Build Signed APK
if: ${{ inputs.release_type != 'none' }}
needs: check_date
if: ${{ inputs.release_type != 'none' && (needs.check_date.outputs.should_run != 'false' && ) }}
runs-on: ubuntu-latest
env: