Skip to content

Commit

Permalink
Add build-image-on-tags GitHub action
Browse files Browse the repository at this point in the history
Description:
- Adds a GitHub Action to build the docker image but tagged
- Use 'k' instead of 'v' to avoid clashing with the existing docker images as this isn't ready to release without testing yet
  • Loading branch information
nimalank7 committed Nov 22, 2023
1 parent 388228a commit ed9471b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/build-image-on-tags.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Build and push images on tags

on:
push:
tags:
- 'k[0-9]+.[0-9]+.[0-9]+'

jobs:
build_and_push:
name: datagovuk-publish
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Login to GHCR
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
with:
ref: ${{ inputs.gitRef }}
- name: Build and push images
env:
APP: datagovuk_publish
ARCH: amd64
GH_REF: ${{ github.ref_name }}
run: ./docker/build-image.sh
4 changes: 4 additions & 0 deletions docker/build-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ build () {

DOCKER_TAG="${GITHUB_SHA}"

if [[ -n ${GH_REF:-} ]]; then
DOCKER_TAG="${GH_REF}"
fi

build "${DOCKER_TAG}"

if [[ -n ${DRY_RUN:-} ]]; then
Expand Down

0 comments on commit ed9471b

Please sign in to comment.