Skip to content

Release PROD - Build & Push Image #32

Release PROD - Build & Push Image

Release PROD - Build & Push Image #32

Workflow file for this run

name: Release PROD - Build & Push Image
on:
workflow_dispatch:
inputs:
version:
description: 'Tag version to build'
required: true
registry:
description: 'Select which registry to build & push to'
required: true
default: 'ALL'
type: choice
options:
- ALL
- VCR_REGISTRY
- VCR_HAN_REGISTRY
jobs:
build-and-push:
runs-on: ubuntu-latest
environment: production
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set common environment
run: |
echo "REGISTRY_INPUT=${{ github.event.inputs.registry }}" >> $GITHUB_ENV
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
- name: Show build config
run: |
echo "Building version: ${{ inputs.version }}"
echo "Target registry: ${{ inputs.registry }}"
###########################
# VCR_REGISTRY
###########################
- name: Build image for VCR_REGISTRY
if: env.REGISTRY_INPUT == 'VCR_REGISTRY' || env.REGISTRY_INPUT == 'ALL'
env:
REGISTRY: ${{ vars.VCR_REGISTRY }}
VERSION: ${{ env.VERSION }}
run: make build-local-images
- name: Login to VCR_REGISTRY
if: env.REGISTRY_INPUT == 'VCR_REGISTRY' || env.REGISTRY_INPUT == 'ALL'
uses: docker/login-action@v3
with:
registry: ${{ vars.VCR_REGISTRY }}
username: ${{ secrets.VCR_USERNAME }}
password: ${{ secrets.VCR_PASSWORD }}
- name: Push image to VCR_REGISTRY
if: env.REGISTRY_INPUT == 'VCR_REGISTRY' || env.REGISTRY_INPUT == 'ALL'
env:
REGISTRY: ${{ vars.VCR_REGISTRY }}
VERSION: ${{ env.VERSION }}
run: make push-local-images
###########################
# VCR_HAN_REGISTRY
###########################
- name: Build image for VCR_HAN_REGISTRY
if: env.REGISTRY_INPUT == 'VCR_HAN_REGISTRY' || env.REGISTRY_INPUT == 'ALL'
env:
REGISTRY: ${{ vars.VCR_HAN_REGISTRY }}
VERSION: ${{ env.VERSION }}
run: make build-local-images
- name: Login to VCR_HAN_REGISTRY
if: env.REGISTRY_INPUT == 'VCR_HAN_REGISTRY' || env.REGISTRY_INPUT == 'ALL'
uses: docker/login-action@v3
with:
registry: ${{ vars.VCR_HAN_REGISTRY }}
username: ${{ secrets.VCR_HAN_USERNAME }}
password: ${{ secrets.VCR_HAN_PASSWORD }}
- name: Push image to VCR_HAN_REGISTRY
if: env.REGISTRY_INPUT == 'VCR_HAN_REGISTRY' || env.REGISTRY_INPUT == 'ALL'
env:
REGISTRY: ${{ vars.VCR_HAN_REGISTRY }}
VERSION: ${{ env.VERSION }}
run: make push-local-images