CDK Deploy Dev Workflow #340
This file contains hidden or 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
| name: CDK Deploy Dev Workflow | |
| permissions: | |
| id-token: write | |
| contents: read | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| branch: | |
| description: "Branch to deploy" | |
| required: true | |
| default: "develop" | |
| pull_request: | |
| types: [labeled, synchronize] | |
| jobs: | |
| deploy: | |
| name: Deploy to dev | |
| runs-on: ubuntu-latest | |
| environment: dev | |
| if: > | |
| github.event_name != 'pull_request' || | |
| (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'deploy-dev')) | |
| steps: | |
| - name: Determine branch to deploy | |
| id: set_branch | |
| env: | |
| # Prevent script injection, since refs/branches can be potentially malicious text. | |
| # See https://docs.github.com/en/actions/reference/security/secure-use#good-practices-for-mitigating-script-injection-attacks | |
| INPUT_BRANCH: ${{ github.event.inputs.branch }} | |
| HEAD_REF: ${{ github.event.pull_request.head.ref }} | |
| REF_NAME: ${{ github.ref_name }} | |
| run: | | |
| if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | |
| echo "branch=$INPUT_BRANCH" >> $GITHUB_OUTPUT | |
| elif [ "${{ github.event_name }}" == "pull_request" ]; then | |
| echo "branch=$HEAD_REF" >> $GITHUB_OUTPUT | |
| else | |
| echo "branch=$REF_NAME" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| ref: ${{ steps.set_branch.outputs.branch }} | |
| persist-credentials: false | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@acca2b1b2070338fb9fd1ca27ecee81d687e58e5 # v6.1.2 | |
| with: | |
| role-to-assume: ${{ secrets.deploy_role_arn }} | |
| role-session-name: test-deploy | |
| aws-region: us-west-2 | |
| - name: Run titiler-cmr deployment | |
| uses: "./.github/actions/cdk-deploy" | |
| with: | |
| dir: "./infrastructure/aws" | |
| env_aws_secret_name: "" | |
| env: | |
| STAGE: ${{ vars.stage }} | |
| TITILER_CMR_EARTHDATA_USERNAME: ${{ vars.earthdata_username }} | |
| TITILER_CMR_EARTHDATA_PASSWORD: ${{ secrets.earthdata_password }} | |
| TITILER_CMR_EARTHDATA_S3_DIRECT_ACCESS: TRUE | |
| TITILER_CMR_TELEMETRY_ENABLED: TRUE | |
| TITILER_CMR_AWS_REQUEST_PAYER: ${{ vars.titiler_cmr_aws_request_payer }} | |
| TITILER_CMR_CLIENT_ID: ${{ vars.titiler_cmr_client_id }} | |
| TITILER_CMR_ROOT_PATH: "" |