This repository has been archived by the owner on Dec 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
stranger80
committed
Nov 27, 2023
1 parent
cdacda5
commit 2c67885
Showing
2 changed files
with
102 additions
and
30 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
name: (prod) 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_Prod: | ||
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::228016254426:role/Aws-GH-Action-Assume-Role-ZKSync-Production | ||
role-session-name: GHZKSync | ||
|
||
- name: Download task definition | ||
run: | | ||
aws ecs describe-task-definition --task-definition zksync-remix-production-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: ${{ env.REGISTRY }}/${{ env.REPOSITORY }}:devnet-${{ needs.Build.outputs.image-version }} | ||
- 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.PROD_SERVICE_NAME }} | ||
cluster: ${{ env.PROD_CLUSTER }} | ||
wait-for-service-stability: true |