idea-release #404
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: Deploy Gear-js to k8s stage/prod | |
on: | |
push: | |
branches: ['stable'] | |
workflow_dispatch: | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: ${{ secrets.AWS_REGION }} | |
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} | |
jobs: | |
wait-previous-run: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: mktcode/consecutive-workflow-action@v1 # please read security note | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag-prod-version: | |
needs: [wait-previous-run] | |
runs-on: ubuntu-latest | |
if: contains(github.event.head_commit.message, 'idea-release') | |
environment: production | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: '0' | |
- name: Bump version and push tag | |
uses: sergeyfilyanin/github-tag-action@main | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
INITIAL_VERSION: '1.0.0' | |
RELEASE_BRANCHES: stable | |
WITH_IDEA: true | |
build-frontend-image-prod: | |
runs-on: ubuntu-latest | |
if: contains(github.event.head_commit.message, 'idea-release') | |
needs: [tag-prod-version] | |
environment: production | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Log in to the github container registry | |
uses: docker/login-action@master | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push Frontend Docker image | |
uses: docker/build-push-action@master | |
with: | |
file: idea/frontend/Dockerfile | |
push: true | |
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-frontend:prod | |
build-args: | | |
REACT_APP_NODE_ADDRESS=${{ secrets.REACT_APP_NODE_ADDRESS }} | |
REACT_APP_API_URL=${{ secrets.REACT_APP_API_URL }} | |
REACT_APP_WASM_COMPILER_URL=${{ secrets.REACT_APP_WASM_COMPILER_URL }} | |
REACT_APP_DEFAULT_NODES_URL=${{ secrets.REACT_APP_DEFAULT_NODES_URL }} | |
REACT_APP_HCAPTCHA_SITE_KEY=${{ secrets.REACT_APP_HCAPTCHA_SITE_KEY }} | |
REACT_APP_DEFAULT_TRANSFER_BALANCE_VALUE=${{ secrets.REACT_APP_DEFAULT_TRANSFER_BALANCE_VALUE }} | |
build-indexer-image-prod: | |
runs-on: ubuntu-latest | |
if: contains(github.event.head_commit.message, 'idea-release') | |
needs: [tag-prod-version] | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Log in to the github container registry | |
uses: docker/login-action@master | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push Indexer Docker image | |
uses: docker/build-push-action@master | |
with: | |
file: idea/indexer/Dockerfile | |
push: true | |
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-indexer:prod | |
build-and-push-meta-storage-image: | |
runs-on: ubuntu-latest | |
if: contains(github.event.head_commit.message, 'idea-release') | |
needs: [tag-prod-version] | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Log in to the github container registry | |
uses: docker/login-action@master | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push Meta Storage Docker image | |
uses: docker/build-push-action@master | |
with: | |
file: idea/meta-storage/Dockerfile | |
push: true | |
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-meta-storage:prod | |
build-api-gateway-image-prod: | |
runs-on: ubuntu-latest | |
if: contains(github.event.head_commit.message, 'idea-release') | |
needs: [tag-prod-version] | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Log in to the github container registry | |
uses: docker/login-action@master | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push Api Gateway Docker image | |
uses: docker/build-push-action@master | |
with: | |
file: idea/api-gateway/Dockerfile | |
push: true | |
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-api-gateway:prod | |
build-test-balance-image-prod: | |
runs-on: ubuntu-latest | |
if: contains(github.event.head_commit.message, 'idea-release') | |
needs: [tag-prod-version] | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Log in to the github container registry | |
uses: docker/login-action@master | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push Test Balance Docker image | |
uses: docker/build-push-action@master | |
with: | |
file: idea/test-balance/Dockerfile | |
push: true | |
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-test-balance:prod | |
deploy-to-k8s-prod: | |
needs: | |
[ | |
build-frontend-image-prod, | |
build-and-push-meta-storage-image, | |
build-indexer-image-prod, | |
build-api-gateway-image-prod, | |
build-test-balance-image-prod, | |
] | |
runs-on: ubuntu-latest | |
if: contains(github.event.head_commit.message, 'idea-release') | |
steps: | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ env.AWS_REGION }} | |
- name: Deploy to k8s | |
uses: sergeyfilyanin/kubectl-aws-eks@master | |
with: | |
args: rollout restart deployment api-gateway indexer-vara indexer-staging indexer-workshop test-balance-staging test-balance-stable frontend-nginx meta-storage -n prod-idea | |
- name: Check k8s deployments | |
uses: sergeyfilyanin/kubectl-aws-eks@master | |
with: | |
args: get deployment -o name -n prod-idea | xargs -n1 -t kubectl rollout status -n prod-idea --timeout=120s |