Skip to content

Commit b107ece

Browse files
authored
Only push versioned docker images on tag (#9192)
1 parent 310441c commit b107ece

File tree

3 files changed

+36
-16
lines changed

3 files changed

+36
-16
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: create_release
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- uses: ncipollo/release-action@v1
14+
with:
15+
token: ${{ secrets.CONSOLEME_GITHUB_TOKEN_CREATE_RELEASE }}

.github/workflows/docker-publish-dockerhub.yaml

+11-8
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,23 @@ jobs:
2424
uses: actions/setup-python@v2
2525
with:
2626
python-version: 3.9
27-
- name: Tag, and push image to DockerHub
27+
- name: Tag, and push unstable image to DockerHub
28+
run: |
29+
docker tag consoleme consoleme/consoleme:unstable
30+
docker push --all-tags consoleme/consoleme
31+
- name: Tag, and push versioned image to DockerHub on tag
32+
if: github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v')
2833
run: |
2934
export CONSOLEME_VERSION=$(python3 setup.py -q --version | sed -r 's/\+/\./g')
3035
export CONSOLEME_MAJOR=$(cut -d '.' -f 1 <<< "$CONSOLEME_VERSION")
3136
export CONSOLEME_MINOR=$(cut -d '.' -f 1,2 <<< "$CONSOLEME_VERSION")
3237
export CONSOLEME_PATCH=$(cut -d '.' -f 1,2,3 <<< "$CONSOLEME_VERSION")
33-
export CONSOLEME_DEV=$(cut -d '.' -f 1,2,3,4 <<< "$CONSOLEME_VERSION")
34-
docker tag consoleme:latest consoleme/consoleme:latest
35-
docker tag consoleme:latest consoleme/consoleme:$CONSOLEME_VERSION
36-
docker tag consoleme:latest consoleme/consoleme:$CONSOLEME_MAJOR
37-
docker tag consoleme:latest consoleme/consoleme:$CONSOLEME_MINOR
38-
docker tag consoleme:latest consoleme/consoleme:$CONSOLEME_PATCH
39-
docker tag consoleme:latest consoleme/consoleme:$CONSOLEME_DEV
38+
docker tag consoleme consoleme/consoleme:$CONSOLEME_VERSION
39+
docker tag consoleme consoleme/consoleme:$CONSOLEME_MAJOR
40+
docker tag consoleme consoleme/consoleme:$CONSOLEME_MINOR
41+
docker tag consoleme consoleme/consoleme:$CONSOLEME_PATCH
4042
docker push --all-tags consoleme/consoleme
43+
4144
deploy_consoleme_demo_site:
4245
name: Deploy Demo Site
4346
if: github.repository == 'Netflix/consoleme'

.github/workflows/docker-publish-ecr.yml

+10-8
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,21 @@ jobs:
3232
- name: Build ConsoleMe
3333
run: |
3434
docker build -t consoleme .
35-
- name: Tag, and push image to Amazon ECR
35+
- name: Tag, and push unstable image to Amazon ECR
36+
run: |
37+
docker tag consoleme public.ecr.aws/consoleme/consoleme:unstable
38+
docker push --all-tags public.ecr.aws/consoleme/consoleme
39+
- name: Tag, and push versioned image to DockerHub on tag
40+
if: github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v')
3641
run: |
3742
# Extract tags from version
3843
export CONSOLEME_VERSION=$(python3 setup.py -q --version | sed -r 's/\+/\./g')
3944
export CONSOLEME_MAJOR=$(cut -d '.' -f 1 <<< "$CONSOLEME_VERSION")
4045
export CONSOLEME_MINOR=$(cut -d '.' -f 1,2 <<< "$CONSOLEME_VERSION")
4146
export CONSOLEME_PATCH=$(cut -d '.' -f 1,2,3 <<< "$CONSOLEME_VERSION")
42-
export CONSOLEME_DEV=$(cut -d '.' -f 1,2,3,4 <<< "$CONSOLEME_VERSION")
4347
# Tag image
44-
docker tag consoleme:latest public.ecr.aws/consoleme/consoleme:latest
45-
docker tag consoleme:latest public.ecr.aws/consoleme/consoleme:$CONSOLEME_VERSION
46-
docker tag consoleme:latest public.ecr.aws/consoleme/consoleme:$CONSOLEME_MAJOR
47-
docker tag consoleme:latest public.ecr.aws/consoleme/consoleme:$CONSOLEME_MINOR
48-
docker tag consoleme:latest public.ecr.aws/consoleme/consoleme:$CONSOLEME_PATCH
49-
docker tag consoleme:latest public.ecr.aws/consoleme/consoleme:CONSOLEME_DEV
48+
docker tag consoleme public.ecr.aws/consoleme/consoleme:$CONSOLEME_VERSION
49+
docker tag consoleme public.ecr.aws/consoleme/consoleme:$CONSOLEME_MAJOR
50+
docker tag consoleme public.ecr.aws/consoleme/consoleme:$CONSOLEME_MINOR
51+
docker tag consoleme public.ecr.aws/consoleme/consoleme:$CONSOLEME_PATCH
5052
docker push --all-tags public.ecr.aws/consoleme/consoleme

0 commit comments

Comments
 (0)