Merge pull request #279 from openaq/staging #169
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 prod | |
on: | |
push: | |
branches: | |
- main | |
env: | |
ENV: "prod" | |
PROJECT: "openaq" | |
DATABASE_READ_USER: ${{ secrets.DATABASE_READ_USER }} | |
DATABASE_READ_PASSWORD: ${{ secrets.DATABASE_READ_PASSWORD }} | |
DATABASE_WRITE_USER: ${{ secrets.DATABASE_WRITE_USER }} | |
DATABASE_WRITE_PASSWORD: ${{ secrets.DATABASE_WRITE_PASSWORD }} | |
DATABASE_DB: ${{ secrets.DATABASE_DB }} | |
DATABASE_HOST: ${{ secrets.DATABASE_HOST }} | |
DATABASE_PORT: ${{ secrets.DATABASE_PORT }} | |
FETCH_ASCENDING: ${{ secrets.FETCH_ASCENDING }} | |
PIPELINE_LIMIT: ${{ secrets.PIPELINE_LIMIT }} | |
METADATA_LIMIT: ${{ secrets.METADATA_LIMIT }} | |
REALTIME_LIMIT: ${{ secrets.REALTIME_LIMIT }} | |
FETCH_BUCKET: ${{ secrets.FETCH_BUCKET }} | |
ETL_BUCKET: ${{ secrets.ETL_BUCKET }} | |
HOSTED_ZONE_ID: ${{ secrets.HOSTED_ZONE_ID }} | |
HOSTED_ZONE_NAME: ${{ secrets.HOSTED_ZONE_NAME }} | |
DOMAIN_NAME: "api.openaq.org" | |
WEB_ACL_ID: ${{ secrets.WEB_ACL_ID }} | |
CERTIFICATE_ARN: ${{ secrets.CERTIFICATE_ARN }} | |
FASTAPI_URL: "" | |
CDK_ACCOUNT: ${{ secrets.CDK_ACCOUNT }} | |
CDK_REGION: ${{ secrets.CDK_REGION }} | |
VPC_ID: ${{ secrets.VPC_ID }} | |
RATE_LIMITING: True | |
RATE_AMOUNT: 100 | |
RATE_AMOUNT_KEY: 400 | |
RATE_TIME: 1 | |
USER_AGENT: ${{ secrets.USER_AGENT }} | |
ORIGIN: ${{ secrets.ORIGIN }} | |
EMAIL_SENDER: ${{ secrets.EMAIL_SENDER }} | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- 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 }} | |
- 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 | |
working-directory: ./cdk | |
run: | | |
pip install -r requirements.txt | |
cdk deploy openaq-api-prod --require-approval never | |
update-docs: | |
needs: deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "18" | |
- uses: actions/setup-python@v3 | |
with: | |
python-version: '3.11' | |
- name: build schema | |
working-directory: ./openaq_api | |
run: | | |
pip install -r requirements.txt | |
npm install -g rdme@latest | |
python generate_schema.py | |
VERSION= | |
rdme openapi openapi.json --version=$VERSION --key=${{ secrets.README_KEY }} --id=${{ secrets.README_API_DEFINITION_ID }} |