Skip to content

Commit

Permalink
Enabling schedule to build images (#38)
Browse files Browse the repository at this point in the history
Signed-off-by: Roshan Khatri <[email protected]>
  • Loading branch information
roshkhatri authored Sep 6, 2024
1 parent 3d35a07 commit d455861
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
19 changes: 17 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
paths:
- '**/Dockerfile*'
schedule:
- cron: 0 0 * * 0
- cron: '0 0 * * *'

defaults:
run:
Expand All @@ -26,6 +26,11 @@ jobs:
name: Generate Jobs
run: |
strategy="$("$BASHBREW_SCRIPTS/github-actions/generate.sh")"
# If triggered by a cron event, filter strategy to include `unstable` and `unstable-alpine`
if [[ "${{ github.event_name }}" == "schedule" ]]; then
strategy=$(jq -c '{"fail-fast": .["fail-fast"],"matrix":{"include":[ .matrix.include[]|select(.name =="unstable" or .name== "unstable-alpine")]}}' <<<"$strategy")
fi
echo "strategy=$strategy" >> "$GITHUB_OUTPUT"
jq . <<<"$strategy" # sanity check / debugging aid
Expand All @@ -51,7 +56,7 @@ jobs:

build_and_push:
if: |
(github.event_name == 'push' &&
((github.event_name == 'push' || github.event_name == 'schedule') &&
github.ref == 'refs/heads/mainline')
needs:
- generate-jobs
Expand Down Expand Up @@ -91,3 +96,13 @@ jobs:
platforms: linux/amd64,linux/arm64,linux/arm/v7
provenance: false
load: false

update-dockerhub-description:
if: |
(github.event_name == 'push' && github.ref == 'refs/heads/mainline')
needs:
- generate-jobs
- test
- build_and_push
name: Update DockerHub Description
uses: ./.github/workflows/update-dockerhub-docs.yml
6 changes: 1 addition & 5 deletions .github/workflows/update-dockerhub-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ name: Update Dockerhub description

on:
workflow_dispatch:
workflow_run:
workflows: [GitHub CI]
types: [completed]
branches: [mainline]
workflow_call:

jobs:
update-dockerhub:
Expand All @@ -15,7 +12,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v4
with:
Expand Down

0 comments on commit d455861

Please sign in to comment.