Updated based on review #339
This file contains 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: Deploy staging | |
on: | |
push: | |
branches: | |
- 'features/**' | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Configure aws credentials | |
uses: aws-actions/configure-aws-credentials@master | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_PROD }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY_PROD }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
- name: Get envionmental values | |
uses: aws-actions/aws-secretsmanager-get-secrets@v2 | |
with: | |
secret-ids: | | |
STAGING, openaq-env/staging | |
name-transformation: uppercase | |
parse-json-secrets: true | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "18" | |
- name: build pages | |
working-directory: ./pages | |
run: | | |
yarn install | |
yarn run deploy | |
- name: Install CDK | |
run: | | |
npm install -g [email protected] | |
- uses: actions/setup-python@v3 | |
with: | |
python-version: '3.11' | |
- name: Deploy stack | |
env: | |
ENV: "staging" | |
PROJECT: "openaq" | |
DATABASE_READ_USER: ${{ env.STAGING_DATABASE_READ_USER }} | |
DATABASE_READ_PASSWORD: ${{ env.STAGING_DATABASE_READ_PASSWORD }} | |
DATABASE_WRITE_USER: ${{ env.STAGING_DATABASE_WRITE_USER }} | |
DATABASE_WRITE_PASSWORD: ${{ env.STAGING_DATABASE_WRITE_PASSWORD }} | |
DATABASE_DB: ${{ env.STAGING_DATABASE_DB }} | |
DATABASE_HOST: ${{ env.STAGING_DATABASE_HOST }} | |
DATABASE_PORT: ${{ env.STAGING_DATABASE_PORT }} | |
API_LAMBDA_MEMORY_SIZE: ${{ env.STAGING_API_LAMBDA_MEMORY_SIZE }} | |
CDK_ACCOUNT: ${{ secrets.CDK_ACCOUNT }} | |
CDK_REGION: ${{ secrets.CDK_REGION }} | |
VPC_ID: ${{ env.STAGING_VPC_ID }} | |
RATE_LIMITING: True | |
RATE_AMOUNT: 10 | |
RATE_AMOUNT_KEY: 60 | |
RATE_TIME: 1 | |
USER_AGENT: ${{ env.STAGING_USER_AGENT }} | |
ORIGIN: ${{ env.STAGING_ORIGIN }} | |
REDIS_HOST: ${{ env.STAGING_REDIS_HOST }} | |
REDIS_PORT: ${{ env.STAGING_REDIS_PORT }} | |
REDIS_SECURITY_GROUP_ID: ${{ env.STAGING_REDIS_SECURITY_GROUP_ID }} | |
EMAIL_SENDER: ${{ env.STAGING_EMAIL_SENDER }} | |
SMTP_EMAIL_HOST: ${{ env.STAGING_SMTP_EMAIL_HOST }} | |
SMTP_EMAIL_USER: ${{ env.STAGING_SMTP_EMAIL_USER }} | |
SMTP_EMAIL_PASSWORD: ${{ env.STAGING_SMTP_EMAIL_PASSWORD }} | |
EXPLORER_API_KEY: ${{ env.STAGING_EXPLORER_API_KEY }} | |
working-directory: ./cdk | |
run: | | |
pip install -r requirements.txt | |
cdk deploy openaq-api-staging --require-approval never |