diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 4878ef62a..9dd77fded 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -8,9 +8,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Create .env-api, .env-issuer and .env-ui files + - name: Create .env-issuer and .env-ui files run: | - touch .env-api touch .env-issuer touch .env-ui - name: Docker Compose diff --git a/.github/workflows/demo_deploy_backend.yml b/.github/workflows/deploy_backend.yml similarity index 89% rename from .github/workflows/demo_deploy_backend.yml rename to .github/workflows/deploy_backend.yml index 63609357e..671fdea4b 100644 --- a/.github/workflows/demo_deploy_backend.yml +++ b/.github/workflows/deploy_backend.yml @@ -3,18 +3,20 @@ name: Deploy Issuer Node Backend to Demo AWS Environment on: workflow_run: workflows: ["Checks"] - branches: ["main"] + branches: ["main", "develop"] types: - completed env: - AWS_ACCOUNT_ID: ${{ secrets.TEST_AWS_ACCOUNT_ID }} + AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }} AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }} - ECR_REPOSITORY: issuer_node_backend_demo + ECR_REPOSITORY: ${{vars.ECR_REPOSITORY}} jobs: build-backend: - name: Build and push latest image to AWS Demo Environment + environment: + name: ${{ github.event.workflow_run.head_branch }} + name: build and push latest image to AWS Environment permissions: id-token: write contents: write diff --git a/.github/workflows/deploy_backend_v2.yml b/.github/workflows/deploy_backend_v2.yml deleted file mode 100644 index 3f0b44a64..000000000 --- a/.github/workflows/deploy_backend_v2.yml +++ /dev/null @@ -1,80 +0,0 @@ -name: Deploy Issuer Node Backend V2 AWS Environment - -on: - workflow_run: - workflows: ["Checks"] - branches: ["develop"] - types: - - completed - -env: - AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }} - -jobs: - build-backend: - environment: - name: ${{ github.event.workflow_run.head_branch }} - name: Build and push issuer node v2 backend image to AWS Environment - permissions: - id-token: write - contents: write - if: ${{ github.event.workflow_run.conclusion == 'success' }} - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - ref: ${{ github.event.workflow_run.head_branch }} - - uses: actions/setup-go@v3 - with: - go-version-file: go.mod - - uses: actions/cache@v3 - with: - path: | - ~/go/pkg/mod - ~/.cache/go-build - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - - name: Print Environment - run: echo ${{ github.event.workflow_run.head_branch }} - - - name: Print branch - run: git branch --show-current - - - name: Create .env-issuer - run: | - touch .env-issuer - - - run: make build/docker - - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1-node16 - env: - AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }} - 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@v1 - id: login-ecr - - - name: Get version - run: echo "::set-output name=VERSION::$(git rev-parse --short HEAD)" - id: version - - - name: Tag and push image - env: - ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} - ECR_REPOSITORY: ${{ vars.ECR_REPOSITORY }} - IMAGE_TAG: ${{ steps.version.outputs.VERSION }} - run: | - docker tag issuer/api:${{ env.IMAGE_TAG }} ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }} - docker push ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }} - - docker tag issuer/api:${{ env.IMAGE_TAG }} ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:latest - docker push ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:latest diff --git a/.github/workflows/demo_deploy_ui.yml b/.github/workflows/deploy_ui.yml similarity index 90% rename from .github/workflows/demo_deploy_ui.yml rename to .github/workflows/deploy_ui.yml index 121f549ed..14646a218 100644 --- a/.github/workflows/demo_deploy_ui.yml +++ b/.github/workflows/deploy_ui.yml @@ -1,4 +1,4 @@ -name: Deploy Issuer Node UI to Demo AWS Environment +name: Deploy Issuer Node UI to AWS Environment on: push: @@ -6,12 +6,14 @@ on: - main env: - AWS_ACCOUNT_ID: ${{ secrets.TEST_AWS_ACCOUNT_ID }} + AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }} AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }} - ECR_REPOSITORY: issuer_node_ui_demo + ECR_REPOSITORY: ${{vars.ECR_REPOSITORY_UI}} jobs: deploy: + environment: + name: ${{ github.ref_name }} name: Build and Deploy UI to Demo AWS Environment runs-on: ubuntu-latest permissions: diff --git a/.github/workflows/test_deploy_backend.yml b/.github/workflows/test_deploy_backend.yml deleted file mode 100644 index 98ea6a825..000000000 --- a/.github/workflows/test_deploy_backend.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: Deploy Issuer Node Backend to Testing AWS Environment - -on: - workflow_run: - workflows: ["Checks"] - branches: ["develop"] - types: - - completed - -env: - AWS_ACCOUNT_ID: ${{ secrets.TEST_AWS_ACCOUNT_ID }} - AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }} - ECR_REPOSITORY: issuer_node_backend_testing - -jobs: - build-backend: - name: Build and push latest image to AWS Testing Environment - permissions: - id-token: write - contents: write - if: ${{ github.event.workflow_run.conclusion == 'success' }} - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - ref: ${{ github.event.workflow_run.head_branch }} - - uses: actions/setup-go@v3 - with: - go-version-file: go.mod - - - name: Print branch - run: git branch --show-current - - - name: Create .env-issuer - run: | - touch .env-issuer - - - run: make build/docker - - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1-node16 - 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@v1 - id: login-ecr - - - name: Get version - run: echo "::set-output name=VERSION::$(git rev-parse --short HEAD)" - id: version - - - name: 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 tag issuer/api:${{ env.IMAGE_TAG }} ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }} - docker push ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }} - - docker tag issuer/api:${{ env.IMAGE_TAG }} ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:latest - docker push ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:latest diff --git a/.github/workflows/test_deploy_ui.yml b/.github/workflows/test_deploy_ui.yml deleted file mode 100644 index f38daf5c0..000000000 --- a/.github/workflows/test_deploy_ui.yml +++ /dev/null @@ -1,61 +0,0 @@ -name: Deploy Issuer Node UI to Testing AWS Environment - -on: - push: - branches: - - develop - -env: - AWS_ACCOUNT_ID: ${{ secrets.TEST_AWS_ACCOUNT_ID }} - AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }} - ECR_REPOSITORY: issuer_node_ui_testing - -jobs: - deploy: - name: Build and Deploy Issuer Node UI to Testing AWS Environment - runs-on: ubuntu-latest - permissions: - id-token: write - contents: write - steps: - - name: Checkout - uses: actions/checkout@v2 - - - uses: actions/setup-node@v2 - with: - node-version: 16 - - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1-node16 - 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@v1 - id: login-ecr - - - name: Get version - run: echo "::set-output name=VERSION::$(git rev-parse --short HEAD)" - id: version - - - name: build ui docker image - working-directory: ./ui - env: - IMAGE_TAG: ${{ steps.version.outputs.VERSION }} - run: | - docker build -t polygonid/issuernode_ui:${{ env.IMAGE_TAG }} . - - - - name: 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 tag polygonid/issuernode_ui:${{ env.IMAGE_TAG }} ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }} - docker push ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }} - - docker tag polygonid/issuernode_ui:${{ env.IMAGE_TAG }} ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:latest - docker push ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:latest