Stage Deploy #6
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: Stage Deploy via SST | |
on: | |
workflow_dispatch: | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Cache Next.js Build | |
uses: actions/cache@v4 | |
with: | |
path: | | |
.next/ | |
.open-next/ | |
.sst/ | |
key: cache-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**.[jt]s', '**.[jt]xs') }} | |
restore-keys: | | |
cache-${{ hashFiles('**/pnpm-lock.yaml') }} | |
- name: Install pnpm | |
run: npm install -g pnpm | |
- name: Install dependencies | |
run: pnpm install | |
- name: Install AWS Creds | |
run: | | |
mkdir -p ~/.aws | |
echo "[default]" > ~/.aws/credentials | |
echo "aws_access_key_id=${{ secrets.AWS_ACCESS_KEY_ID }}" >> ~/.aws/credentials | |
echo "aws_secret_access_key=${{ secrets.AWS_SECRET_ACCESS_KEY }}" >> ~/.aws/credentials | |
- name: Set SST Config Secret | |
run: | | |
npx sst secret set DATABASE_URL ${{ secrets.DATABASE_URL_STAGING }} --stage staging | |
npx sst secret set NEXT_PUBLIC_URL ${{ secrets.NEXT_PUBLIC_URL_STAGING }} --stage staging | |
npx sst secret set COMMIT_SHA ${{ github.sha }} --stage staging | |
- name: Deploy with SST | |
run: pnpm run deploy:stage | |
- name: Clean up AWS Profile | |
run: rm -rf ~/.aws |