Skip to content

Commit

Permalink
Fixes #18 Continuous Deployment
Browse files Browse the repository at this point in the history
* First pass on dev deployment

* Add deploy commands

* Forgot to save the file

* Adjust secret usage

* Permit project overrides

* Add production deployment

* Add environment to production deployment

* Rename production deployment pipeline

* Make deployment flags uniform
  • Loading branch information
oliverspryn authored May 29, 2022
1 parent 993a63e commit 1964c74
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
AUTHORIZED_BROADCAST_PHONE_NUMBERS=
NOTIFY_SERVICE_SID=
WEBHOOK_URL=
30 changes: 30 additions & 0 deletions .github/workflows/dev-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Deploy Develop

on:
push:
branches: [ develop ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout Branch
uses: actions/checkout@v3

- name: Use Node.js 14
uses: actions/setup-node@v3
with:
node-version: 14

- name: Install the twilio-run Toolkit
run: npm install --save-dev twilio-run

- name: Deploy Application
run: npm run deploy
env:
AUTHORIZED_BROADCAST_PHONE_NUMBERS: ${{ secrets.AUTHORIZED_BROADCAST_PHONE_NUMBERS }}
NOTIFY_SERVICE_SID: ${{ secrets.NOTIFY_SERVICE_SID }}
TWILIO_API_KEY: ${{ secrets.TWILIO_API_KEY }}
TWILIO_API_SECRET: ${{ secrets.TWILIO_API_SECRET }}
WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }}
31 changes: 31 additions & 0 deletions .github/workflows/prod-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Deploy Production

on:
release:
types: [ created ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout Branch
uses: actions/checkout@v3

- name: Use Node.js 14
uses: actions/setup-node@v3
with:
node-version: 14

- name: Install the twilio-run Toolkit
run: npm install --save-dev twilio-run

- name: Deploy Application
run: npm run deploy:prod
env:
AUTHORIZED_BROADCAST_PHONE_NUMBERS: ${{ secrets.AUTHORIZED_BROADCAST_PHONE_NUMBERS }}
NOTIFY_SERVICE_SID: ${{ secrets.NOTIFY_SERVICE_SID }}
PROD_FUNCTIONS_SERVICE_SID: ${{ secrets.PROD_FUNCTIONS_SERVICE_SID }}
TWILIO_API_KEY: ${{ secrets.TWILIO_API_KEY }}
TWILIO_API_SECRET: ${{ secrets.TWILIO_API_SECRET }}
WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }}
9 changes: 7 additions & 2 deletions .twilioserverlessrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{
"commands": {},
"commands": {
"deploy": {
"loadSystemEnv": true,
"env": ".env.example"
}
},
"environments": {},
"projects": {},
"runtime": "node14"
}
}
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"version": "1.0.0",
"private": true,
"scripts": {
"deploy": "twilio-run deploy --override-existing-project --username $TWILIO_API_KEY --password $TWILIO_API_SECRET",
"deploy:prod": "twilio-run deploy --override-existing-project --username $TWILIO_API_KEY --password $TWILIO_API_SECRET --environment $PROD_FUNCTIONS_SERVICE_SID",
"start": "twilio serverless:start",
"start:debug": "twilio serverless:start --inspect=\"\"",
"start:tunnel": "twilio serverless:start --ngrok=\"\"",
Expand Down

0 comments on commit 1964c74

Please sign in to comment.