Skip to content

Commit d3b3229

Browse files
authored
Merge pull request #116 from Samagra-Development/add_tagged_workflow
Updates to Workflow for Image Release to Dockerhub 1. Ability to tag image with specific version number (uses the code associated with tag to build image)
2 parents b7011f2 + aa3e323 commit d3b3229

File tree

1 file changed

+29
-20
lines changed

1 file changed

+29
-20
lines changed

.github/workflows/docker-image.yml

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
1-
name: Release Docker Image
1+
name: Tagged Release Docker Image
22
on:
3-
push:
4-
branches: [ release_docker, dev-build ]
53
workflow_dispatch:
64
inputs:
75
version:
86
description: 'Version to release'
97
required: true
10-
# This is a manual workaround until the latest tagging is fixed:
11-
# https://github.com/timescale/timescaledb-docker/issues/205
12-
no_tag_latest:
13-
description: 'Do not tag the published images as latest'
14-
type: boolean
15-
required: false
16-
default: false
8+
ORG:
9+
description: 'the organization for tagging Docker images'
10+
required: true
11+
default: "samagragovernance"
12+
tag_latest:
13+
description: 'Tag the published images as latest'
14+
type: boolean
15+
required: false
16+
default: false
1717
env:
18-
ORG: samagragovernance
18+
ORG: ${{inputs.ORG}}
1919
TS_VERSION: main
20+
BETA: 1 # prevents the latest tag from being pushed.
2021
jobs:
2122

2223
# Build multi-arch TimescaleDB images for both TSL and OSS code.
@@ -31,6 +32,8 @@ jobs:
3132
oss: [ "", "-oss" ]
3233
steps:
3334
- uses: actions/checkout@v3
35+
with:
36+
ref: ${{inputs.version}}
3437

3538
- name: Set up QEMU
3639
uses: docker/setup-qemu-action@v1
@@ -49,13 +52,13 @@ jobs:
4952

5053
- name: Build and push multi-platform Docker image for postgres
5154
run: |
52-
if [ "${{ github.event.inputs.no_tag_latest }}" == "true" ]
53-
then
54-
export BETA=1
55-
fi
56-
make multi${{ matrix.oss }} ORG=$ORG PG_VER=pg${{ matrix.pg }} \
57-
TS_VERSION=$TS_VERSION PREV_EXTRA="${{ matrix.oss }}" BETA=$BETA
58-
55+
if [${{inputs.tag_latest}} == 'true']; then
56+
export BETA=''
57+
fi
58+
make multi${{ matrix.oss }} ORG=$ORG PG_VER=pg${{ matrix.pg }} \
59+
TS_VERSION=$TS_VERSION TAG_VERSION="$TAG_VERSION" PREV_EXTRA="${{ matrix.oss }}" BETA=$BETA
60+
env:
61+
TAG_VERSION: "${{inputs.ORG}}/postgres:${{inputs.version}}-pg${{ matrix.pg }}"
5962
# Build bitnami images of TimscaleDB.
6063
# The images are built only for amd64, since it is the only supported architecture in the base image bitname/postgresql.
6164
# The images are only built for TSL code.
@@ -70,12 +73,18 @@ jobs:
7073

7174
steps:
7275
- uses: actions/checkout@v3
76+
with:
77+
ref: ${{inputs.version}}
7378

7479
- name: Login to DockerHub Registry
7580
run: echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u ${{ secrets.DOCKERHUB_USER }} --password-stdin
7681

7782
- name: Build and push amd64 Docker image for TimescaleDB bitnami
7883
run: |
79-
export BETA=1
80-
make push ORG=$ORG PG_VER=pg${{ matrix.pg }} TS_VERSION=$TS_VERSION BETA=$BETA
84+
if [${{inputs.tag_latest}} == 'true']; then
85+
export BETA=''
86+
fi
87+
make push ORG=$ORG PG_VER=pg${{ matrix.pg }} TS_VERSION=$TS_VERSION BETA=$BETA TAG_VERSION="$TAG_VERSION"
8188
working-directory: bitnami
89+
env:
90+
TAG_VERSION: "${{inputs.ORG}}/timescaledb:${{inputs.version}}-pg${{ matrix.pg }}-bitnami"

0 commit comments

Comments
 (0)