Skip to content

Commit

Permalink
feat: add GHA workflow to keep track of the Ubuntu image SHA
Browse files Browse the repository at this point in the history
* This is to workaround the 3mo timeout for GHA scheduled actions on repos with
  no new commits, by automatically creating new commits.
  • Loading branch information
madwort committed Oct 6, 2023
1 parent 5742c38 commit d7c672b
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/update-ubuntu-sha.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Update SHA of latest ubuntu images
# This is to workaround the 3mo timeout for GHA scheduled actions on repos with
# no new commits, by automatically creating new commits.
on:
schedule:
# check for a new ubuntu image every week at 04:17am on mondays
- cron: "17 04 * * 1"
# let us manually trigger a build
workflow_dispatch:
env:
BASE_IMAGE_NAME: base-docker
ACTION_IMAGE_NAME: base-action
jobs:
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- uses: extractions/setup-just@69d82fb0233557aec017ef13706851d0694e0f1d
- name: update SHAs
run: just update-docker-shas
- name: Commit file
run: |
git status
git add *.sha
if git diff-index --quiet HEAD; then
exit
fi
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -m "Update base image SHA files"
git push origin
13 changes: 13 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

default:
@just --list

# Update the files tracking the SHAs of ubuntu docker image
update-docker-shas:
@just _update-sha "ubuntu:20.04"
@just _update-sha "ubuntu:22.04"

_update-sha os:
echo {{ os }}
docker image pull {{ os }}
docker inspect --format='{{{{index .RepoDigests 0}}' {{ os }} > {{ os }}.sha
1 change: 1 addition & 0 deletions ubuntu:20.04.sha
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ubuntu@sha256:33a5cc25d22c45900796a1aca487ad7a7cb09f09ea00b779e3b2026b4fc2faba
1 change: 1 addition & 0 deletions ubuntu:22.04.sha
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ubuntu@sha256:aabed3296a3d45cede1dc866a24476c4d7e093aa806263c27ddaadbdce3c1054

0 comments on commit d7c672b

Please sign in to comment.