-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (41 loc) · 1.45 KB
/
Copy pathdocker-rename-push.yml
File metadata and controls
45 lines (41 loc) · 1.45 KB
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
on:
workflow_call:
secrets:
from_tag:
description: "The tag you want to rename from"
required: true
to_tag:
description: "The tag you want to rename to."
required: true
image:
description: "The docker image eg. 'myawesomeproject'"
required: true
registry:
description: "The registry you want to push/pull to/from. eg registry.hub.docker.com"
required: true
username:
description: "Username to be used to login to registry"
required: true
password:
description: "Password to be used to login to registry"
required: true
jobs:
pull-rename-push:
runs-on: ubuntu-latest
name: Rename and push
env:
REGISTRY_IMAGE_FROM: ${{ secrets.registry }}/${{ secrets.image }}:${{ secrets.from_tag }}
REGISTRY_IMAGE_TO: ${{ secrets.registry }}/${{ secrets.image }}:${{ secrets.to_tag }}
steps:
- name: Docker login
uses: docker/login-action@v1.10.0
with:
registry: ${{ secrets.registry }}
username: ${{ secrets.username }}
password: ${{ secrets.password }}
- name: Pull image
run: docker pull $REGISTRY_IMAGE_FROM
- name: Rename image
run: docker tag $REGISTRY_IMAGE_FROM $REGISTRY_IMAGE_TO
- name: Push renamed image
run: docker push $REGISTRY_IMAGE_TO