Skip to content

ci: Target correct variable to update parent version #3

ci: Target correct variable to update parent version

ci: Target correct variable to update parent version #3

name: Update Child Images
on:
push:
tags:
- base/*
- swan/*
- swan-cern/*
jobs:
update-dockerfiles:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set Up Git
run: |
git config --global user.name "github-actions"
git config --global user.email "[email protected]"
- name: Detect Parent Image Tag
id: detect-tag
run: |
IMAGE_TAG=${GITHUB_REF#refs/tags/}
echo "PARENT_NAME=jupyter/$(echo $IMAGE_TAG | cut -d / -f 1)" >> $GITHUB_ENV
echo "PARENT_VERSION=$(echo $IMAGE_TAG | cut -d / -f 2)" >> $GITHUB_ENV
- name: Update swan Dockerfile
if: env.PARENT_IMAGE == 'base'
run: |
sed -i "s/^ARG VERSION_PARENT=.*/ARG VERSION_PARENT=${PARENT_VERSION}/" swan/Dockerfile
git add swan/Dockerfile
- name: Update swan-cern Dockerfile
if: env.PARENT_IMAGE == 'swan'
run: |
sed -i "s/^ARG VERSION_PARENT=.*/ARG VERSION_PARENT=${PARENT_VERSION}/" swan-cern/Dockerfile
git add swan-cern/Dockerfile
- name: Update prefetcher Dockerfile
if: env.PARENT_IMAGE == 'swan-cern'
run: |
sed -i "s/^ARG VERSION_PARENT=.*/ARG VERSION_PARENT=${PARENT_VERSION}/" prefetcher/Dockerfile
git add prefetcher/Dockerfile
- name: Commit Changes
run: |
git commit -m "Update images to use new ${PARENT_IMAGE} image version ${PARENT_VERSION}"
- name: Push Changes and Create PR
uses: peter-evans/create-pull-request@v6
with:
branch: update-${{ env.PARENT_IMAGE }}-${{ env.PARENT_VERSION }}
title: "Update images to use new ${{ env.PARENT_IMAGE }} image version ${{ env.PARENT_VERSION }}"
body: "This PR updates the Dockerfiles in the repository to use the new ${{ env.PARENT_IMAGE }} image version ${{ env.PARENT_VERSION }}."
commit-message: "Update Dockerfiles to use new ${{ env.PARENT_IMAGE }} image version ${{ env.PARENT_VERSION }}"
token: ${{ secrets.GITHUB_TOKEN }}
delete-branch: true