Skip to content

Workflow file for this run

name: Deploy to Production
on:
push:
tags:
- 'v*' # Match any tag starting with 'v'
# create:
# branches:
# - 'release/*' # Trigger on creation of release branches
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/release/') # Trigger for tags or release branches
permissions:
id-token: write
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v3
# - name: Setup Node.js
# uses: actions/setup-node@v3
# with:
# node-version: 21 # Adjust as needed
- name: Configure AWS credentials from Test account
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::411486418994:role/github_action_role # shift this to environment variable
aws-region: us-east-1
role-session-name: networkstates-deployment
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Get Git tag
id: git-tag
run: echo "::set-output name=tag::$(git describe --tags --abbrev=0)"
- name: Remove 'v' prefix from tag
id: image-version
run: |
VERSION=${{ steps.git-tag.outputs.tag }}
echo "::set-output name=tag::${VERSION#v}"
- name: Make enclave image and deploy it to ECR
run: |
rm -rf circuits
rm -rf contracts
aws s3 cp s3://test-circuits/circuit_001 . --recursive
chmod +x circuits/virtual/virtual-prover
chmod +x circuits/virtual/virtual-witness-generator
aws --region=us-east-1 ssm get-parameter --name "environment-variable" --output text --query Parameter.Value > .env
docker build -t ${{ steps.login-ecr.outputs.registry }}/test-enclave:${{ steps.image-version.outputs.tag }} --target enclave-deploy .
docker push ${{ steps.login-ecr.outputs.registry }}/test-enclave:${{ steps.image-version.outputs.tag }}
- name: Deploy the infrastructure
run: |
sed -i "s/{{IMAGE_VERSION}}/${{ steps.image-version.outputs.tag }}/" samconfig.toml
sam deploy --config-file ./samconfig.toml --config-env default