Merge pull request #249 from polywrap/release/dev #22
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: CD Prod | |
on: | |
push: | |
branches: | |
- release/prod | |
jobs: | |
Deploy-API: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.10" | |
- name: Install Poetry | |
run: | | |
curl -sSL https://install.python-poetry.org | python3 - | |
- name: Read .nvmrc | |
run: echo ::set-output name=NVMRC::$(cat .nvmrc) | |
id: nvm | |
working-directory: ./workers | |
- name: Setup Node.js | |
uses: actions/setup-node@master | |
with: | |
node-version: '${{ steps.nvm.outputs.NVMRC }}' | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
working-directory: ./workers | |
- uses: actions/cache@v2 | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install dependencies | |
run: (yarn install --nonInteractive --frozen-lockfile --prefer-offline || yarn install --nonInteractive --frozen-lockfile --prefer-offline) | |
working-directory: ./workers | |
# TODO: rename to all "dev" here to prod and update aws accordingly | |
- name: Deploy | |
run: yarn deploy:dev | |
working-directory: ./workers | |
env: | |
DEPLOYMENT_STAGE: dev | |
AWS_ACCESS_KEY_ID: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }} | |
DEV_INNGEST_SIGNING_KEY: ${{ secrets.DEV_INNGEST_SIGNING_KEY }} | |
DEV_INNGEST_EVENT_KEY: ${{ secrets.DEV_INNGEST_EVENT_KEY }} | |
DEV_NEXT_PUBLIC_SUPABASE_URL: ${{ secrets.PROD_NEXT_PUBLIC_SUPABASE_URL }} | |
DEV_NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.PROD_NEXT_PUBLIC_SUPABASE_ANON_KEY }} | |
DEV_SUPABASE_SERVICE_ROLE_KEY: ${{ secrets.PROD_SUPABASE_SERVICE_ROLE_KEY }} | |
DEV_OPENAI_API_KEY: ${{ secrets.DEV_OPENAI_API_KEY}} | |
DEV_PINECONE_API_KEY: ${{ secrets.PROD_PINECONE_API_KEY }} | |
DEV_PINECONE_INDEX_NAME: ${{ secrets.PROD_PINECONE_INDEX_NAME }} | |
Deploy-DB: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Read .nvmrc | |
run: echo ::set-output name=NVMRC::$(cat .nvmrc) | |
id: nvm | |
- name: Setup Node.js | |
uses: actions/setup-node@master | |
with: | |
node-version: '${{ steps.nvm.outputs.NVMRC }}' | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- uses: actions/cache@v2 | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install dependencies | |
run: cp ../yarn.lock ./ && (yarn install --nonInteractive --frozen-lockfile --prefer-offline || yarn install --nonInteractive --frozen-lockfile --prefer-offline) | |
working-directory: ./web | |
- uses: supabase/setup-cli@v1 | |
with: | |
version: latest | |
- run: supabase link --project-ref $PROJECT_ID --password $DB_PASSWORD --debug | |
working-directory: ./web | |
env: | |
DB_PASSWORD: ${{ secrets.PROD_SUPABASE_DB_PASSWORD }} | |
PROJECT_ID: ${{ secrets.PROD_SUPABASE_PROJECT_ID }} | |
SUPABASE_ACCESS_TOKEN: ${{ secrets.DEV_SUPABASE_ACCESS_TOKEN }} | |
- run: supabase db push --password $DB_PASSWORD | |
working-directory: ./web | |
env: | |
DB_PASSWORD: ${{ secrets.PROD_SUPABASE_DB_PASSWORD }} | |
SUPABASE_ACCESS_TOKEN: ${{ secrets.DEV_SUPABASE_ACCESS_TOKEN }} | |
# TODO: update to api.fundpublicgoods.ai once updated in AWS | |
- run: curl -X PUT https://api.dev.fundpublicgoods.ai/api/inngest |