Skip to content

Build Image and Publish to GCR #21

Build Image and Publish to GCR

Build Image and Publish to GCR #21

Workflow file for this run

name: Build Image and Publish to GCR
on:
workflow_dispatch :
# workflow_call:
inputs:
environment:
type: string
required: true
# branch:
# type: string
# required: true
#on:
# push:
# branches: [ "Main-Prod" ]
env:
DOCKER_IMAGE: sts-knowledgebase
jobs:
build-image:
runs-on: ubuntu-22.04
name: Build & Publish Image
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
- name: Get GitHub Runner IP
id: whats-my-ip
uses: ./.github/actions/whats-my-ip-address
- name: GitHub Container Registry Login
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Image & Publish To GCR
uses: docker/build-push-action@v4
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com
context: ./
file: ./src/App/Dockerfile
build-args: COMMIT_SHA=${{ inputs.checked-out-sha }}
#run: |
# docker build . --tag ghcr.io/dfe-digital/sts-knowledgebase/App:latest
# docker push ghcr.io/dfe-digital/sts-knowledgebase/App:latest
tags: |
ghcr.io/dfe-digital/${{ env.DOCKER_IMAGE}}:${{ secrets.MAJOR }}.${{ vars.PATCH_VERSION }}
push: true
- name: Set Action Secret
uses: action-pack/increment@v2
with:
name: 'PATCH_VERSION'
token: ${{ secrets.REPO_ACCESS_TOKEN }}