Skip to content

Commit

Permalink
cd: optimize nightly
Browse files Browse the repository at this point in the history
Add check to only run nightly if changes in the past 24 hours
  • Loading branch information
zaneschepke committed Sep 19, 2024
1 parent e58dad0 commit 230f505
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 9 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/check-date.yml
Original file line number Diff line number Diff line change
@@ -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 changes: 17 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -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 }}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Issue Updates Workflow
name: on-issue

on:
issues:
Expand All @@ -7,8 +7,8 @@ on:

jobs:

build:
name: Build
on-issue:
name: On new issue
runs-on: ubuntu-latest
steps:
- name: Send Telegram Message
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Release Updates Workflow
name: on-publish

on:
release:
Expand All @@ -7,8 +7,8 @@ on:

jobs:

build:
name: Build
on-publish:
name: On publish
runs-on: ubuntu-latest
steps:
- name: Send Telegram Message
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: release-android

on:
schedule:
- cron: "4 3 * * *"
workflow_dispatch:
inputs:
track:
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 230f505

Please sign in to comment.