frontend-build-completed #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker Build and Push CMON Proxy | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Docker image tag (default: latest)' | |
required: false | |
default: 'latest' | |
repository_dispatch: | |
types: [frontend-build-completed] | |
env: | |
REGISTRY: europe-docker.pkg.dev/severalnines-dev/clustercontrol | |
IMAGE_NAME: ccmgr | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.client_payload.branch || github.ref_name }} | |
- run: | | |
echo "Currently on branch: $(git rev-parse --abbrev-ref HEAD)" | |
- id: 'auth' | |
uses: 'google-github-actions/auth@v2' | |
with: | |
credentials_json: '${{ secrets.S9S_DEV_GCP_SA_KEY }}' | |
- name: Configure Docker for GCP Artifact Registry | |
run: | | |
gcloud auth configure-docker europe-docker.pkg.dev --quiet | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: docker/Dockerfile | |
platforms: linux/amd64 | |
load: true | |
tags: ${{ env.IMAGE_NAME }}:${{ inputs.tag }} | |
- name: Tag Docker image | |
run: | | |
docker tag ${{ env.IMAGE_NAME }}:${{ inputs.tag }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ inputs.tag }} | |
- name: Push Docker image | |
run: | | |
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ inputs.tag }} |