Skip to content

Commit

Permalink
serverless v3 + upgraded offline (#365)
Browse files Browse the repository at this point in the history
Co-authored-by: ddennis924 <[email protected]>
Co-authored-by: Jerry Xu <[email protected]>
  • Loading branch information
3 people authored Jul 28, 2024
1 parent 7ff4da9 commit 24f976b
Show file tree
Hide file tree
Showing 28 changed files with 48,318 additions and 104,077 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ on:
types: [published]

jobs:
deploy-production:
deploy-staging:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: '18.x'
node-version: '20.x'

# https://help.github.com/en/actions/configuring-and-managing-workflows/caching-dependencies-to-speed-up-workflows
- name: Cache node modules
Expand Down Expand Up @@ -46,6 +46,6 @@ jobs:
# TODO: deploy all to production
run: |
cd services
for DIR in *; do (cd $DIR && npx serverless deploy --stage prod --conceal && cd ..) & done; wait
for DIR in *; do (cd $DIR && npx sls deploy --stage prod --conceal && cd ..) & done; wait
echo "Finished deployment in prod"
38 changes: 27 additions & 11 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,30 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: '18.x'
node-version: '20.x'

# https://help.github.com/en/actions/configuring-and-managing-workflows/caching-dependencies-to-speed-up-workflows
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install dependencies and Serverless CLI
- name: Install Serverless CLI and dependencies
run: |
sudo npm i -g serverless@3
npm ci
npm install serverless
- name: 'Deploy Dev'
if: github.ref == 'refs/heads/dev'
Expand All @@ -40,12 +42,19 @@ jobs:
STRIPE_DEV_ENDPOINT: ${{ secrets.STRIPE_DEV_ENDPOINT }}
STRIPE_PROD_CANCEL: ${{ secrets.STRIPE_PROD_CANCEL }}
STRIPE_PROD_ENDPOINT: ${{ secrets.STRIPE_PROD_ENDPOINT }}
STRIPE_PROD_KEY: ${{ secrets.STRIPE_PROD_KEY }}
STRIPE_DEV_KEY: ${{ secrets.STRIPE_DEV_KEY }}
STRIPE_PROD_KEY: ${{ secrets.STRIPE_PROD_KEY}}
STRIPE_DEV_KEY: ${{ secrets.STRIPE_DEV_KEY}}
run: |
cd services
for DIR in *; do
(cd $DIR && npx serverless deploy --force --conceal && cd ..) & done; wait
(cd $DIR && sls deploy --conceal \
--STRIPE_DEV_CANCEL ${{ secrets.STRIPE_DEV_CANCEL }} \
--STRIPE_DEV_ENDPOINT ${{ secrets.STRIPE_DEV_ENDPOINT }} \
--STRIPE_PROD_CANCEL ${{ secrets.STRIPE_PROD_CANCEL }} \
--STRIPE_PROD_ENDPOINT ${{ secrets.STRIPE_PROD_ENDPOINT }} \
--STRIPE_PROD_KEY ${{ secrets.STRIPE_PROD_KEY }} \
--STRIPE_DEV_KEY ${{ secrets.STRIPE_DEV_KEY }} \
&& cd ..) & done; wait
- name: 'Deploy Prod'
if: github.ref == 'refs/heads/master'
Expand All @@ -57,9 +66,16 @@ jobs:
STRIPE_DEV_ENDPOINT: ${{ secrets.STRIPE_DEV_ENDPOINT }}
STRIPE_PROD_CANCEL: ${{ secrets.STRIPE_PROD_CANCEL }}
STRIPE_PROD_ENDPOINT: ${{ secrets.STRIPE_PROD_ENDPOINT }}
STRIPE_PROD_KEY: ${{ secrets.STRIPE_PROD_KEY }}
STRIPE_DEV_KEY: ${{ secrets.STRIPE_DEV_KEY }}
STRIPE_PROD_KEY: ${{ secrets.STRIPE_PROD_KEY}}
STRIPE_DEV_KEY: ${{ secrets.STRIPE_DEV_KEY}}
run: |
cd services
for DIR in *; do
(cd $DIR && npx serverless deploy --stage prod --conceal && cd ..) & done; wait
(cd $DIR && sls deploy --stage prod --conceal \
--STRIPE_DEV_CANCEL ${{ secrets.STRIPE_DEV_CANCEL }} \
--STRIPE_DEV_ENDPOINT ${{ secrets.STRIPE_DEV_ENDPOINT }} \
--STRIPE_PROD_CANCEL ${{ secrets.STRIPE_PROD_CANCEL }} \
--STRIPE_PROD_ENDPOINT ${{ secrets.STRIPE_PROD_ENDPOINT }} \
--STRIPE_PROD_KEY ${{ secrets.STRIPE_PROD_KEY }} \
--STRIPE_DEV_KEY ${{ secrets.STRIPE_DEV_KEY }} \
&& cd ..) & done; wait
Loading

0 comments on commit 24f976b

Please sign in to comment.