Skip to content
This repository has been archived by the owner on Dec 6, 2024. It is now read-only.

(develop) Manual devnet deploy #6

(develop) Manual devnet deploy

(develop) Manual devnet deploy #6

Workflow file for this run

name: (develop) Manual devnet deploy
on:
workflow_dispatch:
inputs:
version:
description: 'Devnet version tag'
required: true
type: string
default: 'v0.1.0-alpha.10'
permissions:
id-token: write
contents: read
env:
REGISTRY: "599564732950.dkr.ecr.us-east-2.amazonaws.com"
REPOSITORY: "zksync-remix-plugin"
DEV_CLUSTER: "zksync-remix-plugin-ecs-cluster"
DEV_SERVICE_NAME: "devnet-development-svc"
PROD_CLUSTER: "zksync-remix-plugin-production-ecs-cluster"
PROD_SERVICE_NAME: "devnet-production-svc"
jobs:
Build:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Determine version numbers
id: determine-version
uses: paulhatch/[email protected]
with:
tag_prefix: "v"
major_pattern: "(MAJOR)"
major_regexp_flags: ""
minor_pattern: "(MINOR)"
minor_regexp_flags: ""
version_format: "${major}.${minor}.${patch}-dev${increment}"
bump_each_commit: false
bump_each_commit_patch_pattern: ""
search_commit_body: false
user_format_type: "csv"
enable_prerelease_mode: true
debug: false
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: us-east-2
role-to-assume: arn:aws:iam::599564732950:role/Aws-GH-Action-Assume-Role-ZKSync
role-session-name: GHZKSync
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
with:
mask-password: 'true'
- name: Build, tag, and push docker image to Amazon ECR
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REPOSITORY: ${{ env.REPOSITORY }}
IMAGE_TAG: ${{ steps.determine-version.outputs.version }} # ${{ github.run_number }}
LATEST_RELEASE: ${{ inputs.version }}
run: |
docker build --build-arg LATEST_RELEASE=$LATEST_RELEASE -t $REGISTRY/$REPOSITORY:devnet-$IMAGE_TAG -f ./DockerfileDevnet .
docker push $REGISTRY/$REPOSITORY:devnet-$IMAGE_TAG
outputs:
image-version: ${{ steps.determine-version.outputs.version }}
Deploy_Dev:
runs-on: ubuntu-latest
needs: Build
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: us-east-2
role-to-assume: arn:aws:iam::599564732950:role/Aws-GH-Action-Assume-Role-ZKSync
role-session-name: GHZKSync
- name: Download task definition
run: |
aws ecs describe-task-definition --task-definition zksync-remix-development-devnet --query taskDefinition > task-definition.json
- name: Update the task definition to use the image from Docker Hub
id: task-def
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: task-definition.json
container-name: "devnet"
image: $REGISTRY/$REPOSITORY:devnet-${{ needs.Build.outputs.image-version }}
# - name: Fill in the new image ID in the Amazon ECS task definition
# id: task-def
# uses: aws-actions/amazon-ecs-render-task-definition@v1
# with:
# task-definition: task-definition.json
# container-name: "rocket"
# image: ${{ env.REGISTRY }}/${{ env.REPOSITORY }}:apiserver-${{ needs.Build.outputs.image-version }} #${{ github.run_number }}
# # inject the expected React package URL for CORS logic
# environment-variables: |
# RUST_LOG=INFO
# VITE_URL=https://zksync-plugin.nethermind.dev
# PROMTAIL_USERNAME=${{secrets.PROMTAIL_USERNAME}}
# PROMTAIL_PASSWORD=${{secrets.PROMTAIL_PASSWORD}}
- name: Deploy Amazon ECS task definition
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.task-def.outputs.task-definition }}
service: ${{ env.DEV_SERVICE_NAME }}
cluster: ${{ env.DEV_CLUSTER }}
wait-for-service-stability: true