Skip to content

Commit

Permalink
Add scheduled image build, prune image one hour later
Browse files Browse the repository at this point in the history
  • Loading branch information
dometto committed Jan 18, 2024
1 parent 34f4a5c commit 595b41a
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
38 changes: 38 additions & 0 deletions .github/workflows/cron_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Weekly image build
on:
schedule:
- cron: '22 0 * * 1' # 22 past midnight on Monday

jobs:
build_and_deploy:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
images:
- ubuntu/focal
- ubuntu/jammy
- ubuntu/focal_desktop
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Update submodules to latest version
run: git submodule update --recursive --remote
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build image
id: build-image
run: IMG=${{ matrix.images }} ./pack.sh docker
- name: Get image name and tag # grep in the image directory's variables file to find the image name/tag to push to
id: get-image-name
run: |
echo "docker_repo=`grep docker_repo ${{ matrix.images }}/variables.auto.pkrvars.hcl | awk '{print $3}'`" >> "$GITHUB_OUTPUT"
- name: Push image
run: docker push ${{ steps.get-image-name.outputs.docker_repo }}
2 changes: 1 addition & 1 deletion .github/workflows/prune.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: Prune Untagged Images
on:
schedule:
- cron: '22 0 * * *' # 22 past midnight daily
- cron: '22 1 * * *' # 22 past 1am daily
workflow_dispatch:

jobs:
Expand Down

0 comments on commit 595b41a

Please sign in to comment.