forked from OKDP/jupyterlab-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (57 loc) · 2.05 KB
/
docker-tag-push.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: Pull the image with it's latest tag, apply new tags and push back to container registry
on:
workflow_call:
inputs:
image:
description: Image name
required: true
type: string
registry:
description: The list of tags space separated values
required: true
type: string
runs-on:
description: GitHub Actions Runner image
required: true
type: string
secrets:
registry_username:
required: true
registry_token:
required: true
defaults:
run:
working-directory: ./docker-stacks
jobs:
tag-push:
runs-on: ${{ inputs.runs-on }}
name: ${{ inputs.image }}
steps:
- name: Checkout Repo ⚡️
uses: actions/checkout@v4
- name: Setup dev env patchs 📦
uses: ./.github/actions/install-patchs-and-extension
- name: Create dev environment 📦
uses: ./docker-stacks/.github/actions/create-dev-env
- name: Login to Registry 🔐
uses: docker/login-action@v3
with:
registry: ${{ inputs.registry }}
username: ${{ secrets.registry_username }}
password: ${{ secrets.registry_token }}
- name: Lower github repository owner
run: echo "OWNER=${GITHUB_REPOSITORY_OWNER@L}" >> $GITHUB_ENV
shell: bash
- name: Pull latest tag image 📥
run: docker pull ${{ inputs.registry }}/$OWNER/${{ inputs.image }}
shell: bash
- name: Apply tags to the loaded image 🏷
run: python3 -m okdp.extension.tagging.apply_tags --short-image-name ${{ inputs.image }} --registry ${{ inputs.registry }} --owner $OWNER
- name: Prepare image push 📦
run: |
# The short image name (without tag) is necessary to push to the registry
echo "SHORT_IMAGE_NAME=${{ inputs.image }}" | awk -F: '{print $1}' >> $GITHUB_ENV
shell: bash
- name: Push Images to Registry 📤
run: docker push --all-tags ${{ inputs.registry }}/$OWNER/$SHORT_IMAGE_NAME
shell: bash