Skip to content

Move serverless deployment files into subfolder (#6) #8

Move serverless deployment files into subfolder (#6)

Move serverless deployment files into subfolder (#6) #8

Workflow file for this run

name: Serverless Deploy
on:
push:
branches:
- main
jobs:
sls-deploy:
name: Serverless Deploy
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ github.workspace }}/serverless/
strategy:
matrix:
node-version: [18.x]
steps:
- uses: actions/checkout@v4
- name: create-json
id: create-json
uses: jsdaniell/[email protected]
with:
name: "service-account-credentials.json"
json: ${{ secrets.SERVICE_ACCOUNT_CREDENTIALS }}
- run: |
git config --global user.email "${GITHUB_ACTOR_ID}+${GITHUB_ACTOR}@users.noreply.github.com"
git config --global user.name "${GITHUB_ACTOR}"
git add .
git add --force service-account-credentials.json
git status
git commit -a -m "Deploy Service Account Credentials JSON"
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm shrinkwrap
- run: npm ci
- name: serverless install plugins
uses: serverless/[email protected]
with:
args: -c "serverless plugin install --name serverless-python-requirements"
entrypoint: /bin/sh
- name: serverless deploy
uses: serverless/[email protected]
with:
args: -c "cd ./serverless && serverless deploy --stage ${{ env.CI_ENV }} --verbose"
entrypoint: /bin/sh
env:
CI_ENV: prod
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
DEPLOYMENT_BUCKET: ${{ secrets.DEPLOYMENT_BUCKET_PREFIX }}-${{ secrets.AWS_REGION }}
SPREADSHEET_ID: ${{ vars.SPREADSHEET_ID }}
BUCKET_NAME: ${{ vars.BUCKET_NAME }}
BUCKET_KEY: ${{ vars.BUCKET_KEY }}