-
Notifications
You must be signed in to change notification settings - Fork 157
52 lines (41 loc) · 1.4 KB
/
docker-tag.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
name: Docker Tag CI
on:
workflow_dispatch:
inputs:
existing_tag:
description: 'The existing tag of the docker image'
required: true
type: string
new_tag:
description: 'The new tag of the docker image'
required: true
type: string
image_name:
description: 'The name of the docker image to tag'
required: true
type: string
tracker_hash:
description: '[Internal usage] Used for tracking workflow job status within Meta infra'
required: false
type: str
env:
REGISTRY: ghcr.io
IMAGE_NAME: ghcr.io/${{ github.repository }}/${{ github.event.inputs.image_name }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Print Tracker Hash
run: echo ${{ github.event.inputs.tracker_hash}}
- uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull image from rc registry
run: docker pull ${{ env.IMAGE_NAME }}:${{ github.event.inputs.existing_tag }}
- name: Tag docker image
run: docker tag ${{ env.IMAGE_NAME }}:${{ github.event.inputs.existing_tag }} ${{ env.IMAGE_NAME }}:${{ github.event.inputs.new_tag }}
- name: Push docker image to prod registry
run: docker push --all-tags ${{ env.IMAGE_NAME }}