|
12 | 12 | required: false
|
13 | 13 | DS_RELEASE_BOT_PRIVATE_KEY:
|
14 | 14 | required: false
|
15 |
| - |
| 15 | + AWS_DEFAULT_REGION_DEPLOY: |
| 16 | + required: false |
| 17 | + AWS_ACCESS_KEY_ID_DEPLOY: |
| 18 | + required: false |
| 19 | + AWS_SECRET_ACCESS_KEY_DEPLOY: |
| 20 | + required: false |
| 21 | + AWS_ACCOUNT_ID: |
| 22 | + required: false |
16 | 23 | jobs:
|
17 | 24 | build_and_package:
|
18 | 25 | name: Build and package
|
19 | 26 | runs-on: ubuntu-latest
|
| 27 | + timeout-minutes: 60 |
| 28 | + env: |
| 29 | + AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION_DEPLOY }} |
| 30 | + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_DEPLOY }} |
| 31 | + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_DEPLOY }} |
| 32 | + AWS_DEFAULT_ACCOUNT: ${{ secrets.AWS_ACCOUNT_ID }} |
20 | 33 | steps:
|
21 | 34 | - uses: actions/checkout@v3
|
22 | 35 |
|
23 | 36 | - uses: actions/setup-node@v3
|
24 | 37 | with:
|
25 |
| - node-version: 16 |
| 38 | + node-version: 18 |
26 | 39 | cache: "npm"
|
27 | 40 |
|
28 | 41 | - name: Install Dependencies
|
|
65 | 78 | app_id: ${{ secrets.DS_RELEASE_BOT_ID }}
|
66 | 79 | private_key: ${{ secrets.DS_RELEASE_BOT_PRIVATE_KEY }}
|
67 | 80 |
|
68 |
| - - name: Maybe Release 🚀 |
| 81 | + - name: Check release |
| 82 | + id: check_release |
69 | 83 | if: ${{ inputs.release }}
|
| 84 | + run: | |
| 85 | + SHOULD_RELEASE=false |
| 86 | + npm run semantic-release --dry-run > check_release_output.txt |
| 87 | + if grep -q "Published release" check_release_output.txt; then |
| 88 | + echo "SHOULD_RELEASE=true" >> $GITHUB_OUTPUT |
| 89 | + else |
| 90 | + echo "SHOULD_RELEASE=false" >> $GITHUB_OUTPUT |
| 91 | + fi |
| 92 | +
|
| 93 | + - name: Install deployment environment |
| 94 | + if: "${{ inputs.release && steps.check_release.outputs.SHOULD_RELEASE }}" |
| 95 | + id: install_deploy_env |
| 96 | + run: | |
| 97 | + # install deployment environment with eoapi-cdk from build |
| 98 | + python -m venv .deployment_venv |
| 99 | + source .deployment_venv/bin/activate |
| 100 | + pip install dist/python/*.gz |
| 101 | + cd integration_tests/cdk |
| 102 | + pip install -r requirements.txt |
| 103 | + npm install |
| 104 | + deactivate |
| 105 | + cd - |
| 106 | +
|
| 107 | +
|
| 108 | + - name: Deploy test stack |
| 109 | + if: "${{ inputs.release && steps.check_release.outputs.SHOULD_RELEASE }}" |
| 110 | + id: deploy_step |
| 111 | + run: | |
| 112 | + source .deployment_venv/bin/activate |
| 113 | + |
| 114 | + # synthesize the stack |
| 115 | + cd integration_tests/cdk |
| 116 | + npx cdk synth --debug --all --require-approval never |
| 117 | +
|
| 118 | + # deploy the stack and grab URLs for testing |
| 119 | + npx cdk deploy --ci --all --require-approval never |
| 120 | + echo "ingestor_url=$(aws cloudformation describe-stacks --stack-name eoapi-cdk-integration-test-pgSTAC-infra --query "Stacks[0].Outputs[?starts_with(OutputKey, 'stacingestor')].OutputValue | [0]" --output text)" >> $GITHUB_OUTPUT |
| 121 | + echo "stac_api_url=$(aws cloudformation describe-stacks --stack-name eoapi-cdk-integration-test-pgSTAC-infra --query "Stacks[0].Outputs[?starts_with(OutputKey, 'pgstacapi')].OutputValue | [0]" --output text)" >> $GITHUB_OUTPUT |
| 122 | + echo "titiler_pgstac_api_url=$(aws cloudformation describe-stacks --stack-name eoapi-cdk-integration-test-pgSTAC-infra --query "Stacks[0].Outputs[?starts_with(OutputKey, 'titilerpgstac')].OutputValue | [0]" --output text)" >> $GITHUB_OUTPUT |
| 123 | + deactivate |
| 124 | + cd - |
| 125 | + |
| 126 | + - name: Tear down any infrastructure |
| 127 | + if: always() |
| 128 | + run: | |
| 129 | + cd integration_tests/cdk |
| 130 | + # run this only if we find a 'cdk.out' directory, which means there might be things to tear down |
| 131 | + if [ -d "cdk.out" ]; then |
| 132 | + cd - |
| 133 | + source .deployment_venv/bin/activate |
| 134 | + cd integration_tests/cdk |
| 135 | + # see https://github.com/aws/aws-cdk/issues/24946 |
| 136 | + rm -f cdk.out/synth.lock |
| 137 | + npx cdk destroy --ci --all --force |
| 138 | + fi |
| 139 | + |
| 140 | + |
| 141 | + # run if the previous step set SHOULD_RELEASE to true |
| 142 | + - name: Maybe Release 🚀 |
| 143 | + # only run if the previous step set SHOULD_RELEASE to true |
| 144 | + if: "${{ inputs.release && steps.check_release.outputs.SHOULD_RELEASE }}" |
70 | 145 | run: |
|
71 | 146 | npm run semantic-release
|
72 | 147 | env:
|
|
0 commit comments