Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

github action push to ecr #6

Merged
merged 4 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 0 additions & 46 deletions .github/workflows/e2e-tests.yaml

This file was deleted.

58 changes: 58 additions & 0 deletions .github/workflows/publish-backend-erc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Deploy onchain merklized backend to AWS ECR

on:
workflow_dispatch:
push:
branches:
- master

env:
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID_PRIVADO_ID }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION_PRIVADO_ID }}
ECR_REPOSITORY: onchain_merklized_issuer_backend_demo

jobs:
deploy:
environment:
name: ${{ github.ref_name }}
name: Build and deploy ochain merklized issuer backend to AWS ECR
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 16

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ env.AWS_DEFAULT_REGION }}
role-to-assume: arn:aws:iam::${{ env.AWS_ACCOUNT_ID }}:role/PolygonIDActionsRole
role-session-name: GitHubActionsSession

- name: Login to Amazon ECR
uses: aws-actions/amazon-ecr-login@v2
id: login-ecr

- name: Get version
run: echo "::set-output name=VERSION::$(git rev-parse --short HEAD)"
id: version

- name: Build with tag and push image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: ${{ env.ECR_REPOSITORY }}
IMAGE_TAG: ${{ steps.version.outputs.VERSION }}
run: |
docker build \
-t ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:latest \
-t ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }} \
-f client/Dockerfile client

docker push ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }}
docker push ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:latest
59 changes: 59 additions & 0 deletions .github/workflows/publish-frontend-erc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Deploy onchain merklized frontend to AWS ECR

on:
workflow_dispatch:
push:
branches:
- master

env:
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID_PRIVADO_ID }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION_PRIVADO_ID }}
ECR_REPOSITORY: onchain_merklized_issuer_frontend_demo

jobs:
deploy:
environment:
name: ${{ github.ref_name }}
name: Build and deploy ochain merklized issuer frontend to AWS ECR
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 16

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ env.AWS_DEFAULT_REGION }}
role-to-assume: arn:aws:iam::${{ env.AWS_ACCOUNT_ID }}:role/PolygonIDActionsRole
role-session-name: GitHubActionsSession

- name: Login to Amazon ECR
uses: aws-actions/amazon-ecr-login@v2
id: login-ecr

- name: Get version
run: echo "::set-output name=VERSION::$(git rev-parse --short HEAD)"
id: version

- name: Build with tag and push image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: ${{ env.ECR_REPOSITORY }}
IMAGE_TAG: ${{ steps.version.outputs.VERSION }}
run: |
docker build \
-t ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:latest \
-t ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }} \
--build-arg="NEXT_PUBLIC_ISSUER_URL={{ env.NEXT_PUBLIC_ISSUER_URL }}" \
-f client/Dockerfile client

docker push ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }}
docker push ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:latest
42 changes: 0 additions & 42 deletions .github/workflows/publish.yaml

This file was deleted.

5 changes: 4 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"reflect"
"strconv"
"strings"
"time"

"github.com/ethereum/go-ethereum/ethclient"
auth "github.com/iden3/go-iden3-auth/v2"
Expand Down Expand Up @@ -69,10 +70,12 @@ func main() {
logger.WithError(err).Fatal("error creating package manager")
}

//nolint:govet //resource leak is handled by shutdown manager
mongoConnectTimeout, _ := context.WithTimeout(context.Background(), time.Second*20)
reg := bson.NewRegistry()
reg.RegisterTypeMapEntry(bson.TypeEmbeddedDocument, reflect.TypeOf(bson.M{}))
opts := options.Client().ApplyURI(cfg.MongoDBConnectionString).SetRegistry(reg)
mongoClient, err := mongo.Connect(context.Background(), opts)
mongoClient, err := mongo.Connect(mongoConnectTimeout, opts)
if err != nil {
logger.WithError(err).Fatal("error connecting to mongodb")
}
Expand Down
2 changes: 0 additions & 2 deletions tests/e2e/README.md

This file was deleted.

47 changes: 0 additions & 47 deletions tests/e2e/e2e.postman_collection.json

This file was deleted.

Loading