Feature/updates for token 2049 #13
Workflow file for this run
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: "CICD staging" | |
on: | |
# Test run before merging | |
pull_request: | |
branches: | |
- main | |
# On merged | |
push: | |
branches: | |
- main | |
# On released | |
release: | |
types: [created] | |
jobs: | |
build-docker: | |
permissions: | |
id-token: write | |
contents: write | |
runs-on: ubuntu-22.04 | |
if: github.actor != 'dependabot[bot]' && github.ref_name == 'main' && github.event_name != 'release' | |
name: "Build and push images" | |
strategy: | |
fail-fast: false | |
matrix: | |
application: [developer-portal, devex, devex-apollo, neo-savant] | |
include: | |
- application: developer-portal | |
image_name: zilliqa-devportal | |
path: products/developer-portal | |
- application: devex | |
image_name: devex | |
path: products/devex | |
- application: devex-apollo | |
image_name: devex-apollo | |
path: products/devex-apollo | |
- application: neo-savant | |
image_name: neo-savant | |
path: products/neo-savant | |
env: | |
DOCKER_DOMAIN: asia-docker.pkg.dev | |
REGISTRY: asia-docker.pkg.dev/prj-d-devops-services-4dgwlsse/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 - staging" | |
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_STG_GITHUB_SA_DOCKER_REGISTRY }}" | |
create_credentials_file: true | |
- name: Login to the registry - staging | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.DOCKER_DOMAIN }} | |
username: "oauth2accesstoken" | |
password: "${{ steps.google-auth.outputs.access_token }}" | |
- name: Get tag version staging - staging | |
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 }} - staging" | |
env: | |
ENVIRONMENT: stg | |
IMAGE_TAG: ${{ steps.set-tag.outputs.tags }} | |
run: | | |
cd ${{ matrix.path }} | |
make image/build-and-push |