Deploy to mainnet by @Martin-ryunseok #14
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: Selectable Environment CICD | |
run-name: Deploy to ${{ github.event.inputs.environment }} by @${{ github.actor }} | |
permissions: | |
id-token: write | |
contents: read | |
on: | |
workflow_dispatch: | |
inputs: | |
environment: | |
description: "Select Environment" | |
type: choice | |
required: true | |
options: | |
- "devnet" | |
- "sepolia" | |
- "mainnet" | |
env: | |
APP_NAME: blockscout-v3 | |
IMAGE_NAME: blockscout-v3 | |
NAMESPACE: kroma-ecosystem | |
jobs: | |
ci: | |
environment: ${{ github.event.inputs.environment }} | |
runs-on: ubuntu-latest | |
outputs: | |
IMAGE_TAG: ${{ steps.predefined.outputs.IMAGE_TAG }} | |
steps: | |
- name: Check out source code | |
uses: actions/checkout@v3 | |
- name: Predefined | |
id: predefined | |
run: echo "IMAGE_TAG=$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_OUTPUT | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: arn:aws:iam::${{ secrets.ACCOUNT_ID }}:role/${{ secrets.KROMA_GITHUB_ACTION_ROLE }} | |
aws-region: ap-northeast-2 | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Publish Kroma Blockscout V3 Backend | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ./docker/Dockerfile | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
push: true | |
tags: ${{ secrets.AWS_ECR_REPOSITORY }}/blockscout-v3:${{ steps.predefined.outputs.IMAGE_TAG }},${{ secrets.AWS_ECR_REPOSITORY }}/blockscout-v3:latest | |
platforms: linux/amd64 | |
build-args: | | |
DISABLE_WEBAPP=false | |
CACHE_EXCHANGE_RATES_PERIOD= | |
API_V1_READ_METHODS_DISABLED=false | |
API_V1_WRITE_METHODS_DISABLED=false | |
CACHE_TOTAL_GAS_USAGE_COUNTER_ENABLED= | |
ADMIN_PANEL_ENABLED=false | |
DECODE_NOT_A_CONTRACT_CALLS=false | |
MIXPANEL_URL= | |
MIXPANEL_TOKEN= | |
AMPLITUDE_URL= | |
AMPLITUDE_API_KEY= | |
CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL= | |
BLOCKSCOUT_VERSION=v6.5.0-beta | |
RELEASE_VERSION=6.5.0 | |
CHAIN_TYPE=optimism | |
cd: | |
needs: ci | |
environment: ${{ github.event.inputs.environment }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Target Repository | |
uses: actions/checkout@v3 | |
with: | |
repository: kroma-network/devops-helm | |
ref: main | |
token: ${{ secrets.KROMA_GIT_TOKEN }} | |
- name: Update Image Tag | |
uses: mikefarah/yq@master | |
with: | |
cmd: | | |
yq -i '.backend.image.tag = "${{ needs.ci.outputs.IMAGE_TAG }}"' '${{ env.NAMESPACE }}/${{ env.APP_NAME }}/${{ secrets.CLUSTER }}.yaml' | |
- name: Push Changed Image Tag | |
run: | | |
git config --global user.email lightscale@lightscale.io | |
git config --global user.name lightscale | |
if [ -z "$(git status --porcelain)" ] | |
then | |
echo "Nothing to commit, working directory clean" | |
else | |
git commit -am "${{ env.APP_NAME }} ${{ needs.ci.outputs.IMAGE_TAG }}" && git push | |
fi |