From f7a0bc0163cad14eccc111120d01055e766d682b Mon Sep 17 00:00:00 2001 From: Sean Fern Date: Sat, 16 Dec 2023 01:13:24 -0500 Subject: [PATCH] PLT-271 Add test (impl) deploy workflow for opt-out-import (#73) --- .../workflows/opt-out-import-deploy-test.yml | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/opt-out-import-deploy-test.yml diff --git a/.github/workflows/opt-out-import-deploy-test.yml b/.github/workflows/opt-out-import-deploy-test.yml new file mode 100644 index 0000000..e20c09d --- /dev/null +++ b/.github/workflows/opt-out-import-deploy-test.yml @@ -0,0 +1,49 @@ +name: Build and deploy opt-out-import to test (impl) + +on: + push: + branches: + - main + paths: + - optout/** + workflow_dispatch: + +env: + AWS_REGION: ${{ vars.AWS_REGION }} + +jobs: + deploy: + runs-on: self-hosted + environment: test + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up JDK + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + + - name: Set env vars from AWS params + uses: cmsgov/ab2d-bcda-dpc-platform/actions/aws-params-env-action@main + with: + params: | + ARTIFACTORY_URL=/artifactory/url + ARTIFACTORY_USER=/artifactory/user + ARTIFACTORY_PASSWORD=/artifactory/password + + - name: Build opt-out-import zip file + run: ./gradlew buildZip -b optout/build.gradle --console=plain + + - name: Assume role in target account + uses: aws-actions/configure-aws-credentials@v3 + with: + aws-region: ${{ vars.AWS_REGION }} + role-to-assume: ${{ vars.ACCOUNT_ROLE }} + + - name: Upload and reload + run: | + aws s3 cp --no-progress optout/build/distributions/optout.zip s3://${{ vars.OPT_OUT_IMPORT_BUCKET }}/function.zip + aws lambda update-function-code --function-name ab2d-test-opt-out-import --s3-bucket ${{ vars.OPT_OUT_IMPORT_BUCKET }} --s3-key function.zip