Skip to content

Updated for full dev deployment stage #6

Updated for full dev deployment stage

Updated for full dev deployment stage #6

Workflow file for this run

name: Deploy Dev Stage
on:
push:
branches: [ dev ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
API_KEY: ${{ secrets.NEON_API_KEY }}
STAGE: dev
GH_TOKEN: ${{ github.token }} # github cli -> gh
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "20.11"
cache: 'npm'
- name: Install dependencies
run: npm install
- name: Install neonctl and tsx
run: npm install -g neonctl tsx
- name: Delete Previous Branch
run: neonctl branches delete dev --api-key ${{ env.API_KEY }}
continue-on-error: true
- name: Create Branched Database
run: neonctl branches create --name dev --api-key ${{ env.API_KEY }}
- name: Branch Connection String in Parameter Store
run: |
export DB_URL=$(neonctl connection-string --branch dev --api-key ${{ env.API_KEY }})
npx tsx src/cli/putSecrets.js dev $DB_URL
- name: Deploy dev stage
run: |
npm run deploy-dev-stage
- name: Dev Stage Pull Request
run: |
export PR_BRANCH=$(git branch --show-current)
export DEFAULT_BRANCH=$(git remote show origin | awk '/HEAD branch/ {print $NF}')
echo "$PR_BRANCH and $DEFAULT_BRANCH"
export DEV_STAGE_INFO=$(npm run info-dev-stage)
gh pr create --title "Automated PR from Dev Stage" --body "$DEV_STAGE_INFO" --base $DEFAULT_BRANCH --head $PR_BRANCH --repo $GITHUB_REPOSITORY