Tidy up dynamodb schema and UI store (#59) #30
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: Build and deploy API | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- "server/src/**" | |
workflow_dispatch: | |
inputs: | |
buildManually: | |
description: 'Deploy API manually' | |
required: true | |
default: build | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
environment: prod | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_FOR_GITHUB_DEPLOY }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_GITHUB_DEPLOY }} | |
AWS_REGION_NAME: ${{ secrets.AWS_REGION_NAME }} | |
GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }} | |
GOOGLE_PLACES_API_KEY: ${{ secrets.GOOGLE_PLACES_API_KEY }} | |
JWT_SECRET: ${{ secrets.JWT_SECRET }} | |
ALBUM_URL: ${{ secrets.ALBUM_URL }} | |
IMAGEKIT_CDN_URL: ${{ secrets.IMAGEKIT_CDN_URL }} | |
AWS_S3_BUCKET_NAME: ${{ secrets.AWS_S3_BUCKET_NAME }} | |
PHOTO_ALBUMS_TABLE_NAME: ${{ secrets.PHOTO_ALBUMS_TABLE_NAME }} | |
PHOTO_ALBUM_TAGS_TABLE_NAME: ${{ secrets.PHOTO_ALBUM_TAGS_TABLE_NAME }} | |
PHOTO_USER_PERMISSION_TABLE_NAME: ${{ secrets.PHOTO_USER_PERMISSION_TABLE_NAME }} | |
DATA_AGGREGATIONS_TABLE_NAME: ${{ secrets.DATA_AGGREGATIONS_TABLE_NAME }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install dependencies and test | |
run: | | |
npm install | |
cd ./server | |
npm install | |
npm run test:server | |
- name: Write .env file | |
run: | | |
cd ./server | |
tee .env <<EOF | |
AWS_REGION_NAME=$AWS_REGION_NAME | |
GOOGLE_PLACES_API_KEY=$GOOGLE_PLACES_API_KEY | |
GOOGLE_CLIENT_ID=$GOOGLE_CLIENT_ID | |
JWT_SECRET=$JWT_SECRET | |
ALBUM_URL=$ALBUM_URL | |
IMAGEKIT_CDN_URL=$IMAGEKIT_CDN_URL | |
AWS_S3_BUCKET_NAME=$AWS_S3_BUCKET_NAME | |
PHOTO_ALBUMS_TABLE_NAME=$PHOTO_ALBUMS_TABLE_NAME | |
PHOTO_ALBUM_TAGS_TABLE_NAME=$PHOTO_ALBUM_TAGS_TABLE_NAME | |
PHOTO_USER_PERMISSION_TABLE_NAME=$PHOTO_USER_PERMISSION_TABLE_NAME | |
DATA_AGGREGATIONS_TABLE_NAME=$DATA_AGGREGATIONS_TABLE_NAME | |
EOF | |
- name: Serverless deploy | |
uses: serverless/github-action@master | |
with: | |
args: -c "cd ./server && serverless deploy --stage prod --force --conceal" | |
entrypoint: /bin/sh |