Skip to content

Update docker tag to latest #69

Update docker tag to latest

Update docker tag to latest #69

name: Update docker tag to latest
on:
workflow_dispatch:
schedule:
- cron: "0 0 */7 * *"
jobs:
update_image:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Find latest tag & Update Dockerfile
id: find_latest_tag
run: |
LATEST_TAG=$(curl -s 'https://hub.docker.com/v2/repositories/library/ubuntu/tags' -H 'Content-Type: application/json' | jq -r '.results[]| .name' | grep noble |head -n 1)
echo "Latest tag: $LATEST_TAG"
if [[ "$LATEST_TAG" != "$(cat docker/create-custom-user-ubuntu | grep 'FROM ubuntu:' | awk -F ':' '{print $2}')" ]]; then
sed -i "s/FROM ubuntu:.*/FROM ubuntu:$LATEST_TAG/" docker/create-custom-user-ubuntu
echo "FILE_CHANGED=true" >> $GITHUB_OUTPUT
fi
- name: Commit and push changes
if: ${{ steps.find_latest_tag.outputs.FILE_CHANGED == 'true' }}
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -am "Update Ubuntu Noble image"
git push