Skip to content

fix: trigger prod pipeline only when releases or pre-release are publ… #46

fix: trigger prod pipeline only when releases or pre-release are publ…

fix: trigger prod pipeline only when releases or pre-release are publ… #46

Workflow file for this run

name: "CICD production"
on:
# On merged
push:
branches:
- main
# On released
release:
types: [published]
jobs:
build-docker:
permissions:
id-token: write
contents: write
runs-on: ubuntu-22.04
if: github.actor != 'dependabot[bot]'
name: "Deploy image"
strategy:
fail-fast: false
matrix:
application:
[bluebell-playground, developer-portal, devex, eth-spout, neo-savant]
include:
- application: bluebell-playground
image_name: bluebell-playground
path: products/bluebell
- application: devex
image_name: devex
path: products/devex
- application: developer-portal
image_name: developer-portal
path: products/developer-portal
- application: eth-spout
image_name: eth-spout
path: products/eth-spout
- application: neo-savant
image_name: neo-savant
path: products/neo-savant
env:
DOCKER_DOMAIN: asia-docker.pkg.dev
REGISTRY: asia-docker.pkg.dev/prj-p-devops-services-tvwmrf63/zilliqa-public
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 0
- name: "Authenticate to Google Cloud - production"
id: google-auth
uses: "google-github-actions/auth@v1"
with:
token_format: "access_token"
workload_identity_provider: "${{ secrets.GCP_PRD_GITHUB_WIF }}"
service_account: "${{ secrets.GCP_PRD_GITHUB_SA_DOCKER_REGISTRY }}"
create_credentials_file: true
- name: Login to the registry - production
uses: docker/login-action@v2
with:
registry: ${{ env.DOCKER_DOMAIN }}
username: "oauth2accesstoken"
password: "${{ steps.google-auth.outputs.access_token }}"
- name: Get tag version - production
if: github.event_name == 'push'
id: set-tag
uses: Zilliqa/gh-actions-workflows/actions/generate-tag@v1
with:
tag: ${{ env.REGISTRY }}/${{ matrix.image_name }}
length: 8
- name: "Build and push ${{ matrix.application }} - production"
if: github.event_name == 'push'
env:
ENVIRONMENT: prd
IMAGE_TAG: ${{ steps.set-tag.outputs.tags }}
run: |
cd ${{ matrix.path }}
make image/build-and-push
- name: "Build and push ${{ matrix.application }} - production"
if: github.event_name == 'release'
env:
ENVIRONMENT: prd
IMAGE_TAG: ${{ env.REGISTRY }}/${{ matrix.image_name }}:${{ github.ref_name }}
ENV_FILES_DECRYPTER_NONPRD: ${{ secrets.ENV_FILES_DECRYPTER_NONPRD }}
ENV_FILES_DECRYPTER_PRD: ${{ secrets.ENV_FILES_DECRYPTER_PRD }}
run: |
cd ${{ matrix.path }}
make image/build-and-push