Remove .babelrc #100
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: Twilio Continuous Deployment | |
on: | |
push: | |
branches: | |
- main | |
- dev1 | |
- dev2 | |
paths-ignore: | |
- 'README.md' | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Install dependencies for the twilio function | |
run: npm install | |
- name: twilio-cli | |
run: npm install -g twilio-cli | |
- name: twilio serverless | |
run: twilio plugins:install @twilio-labs/plugin-serverless@v3 | |
- name: Compile TypeScript files to JavaScript | |
run: npm run build | |
- name: twilio serverless:deploy | |
env: | |
TWILIO_ACCOUNT_SID: ${{ secrets.TWILIO_ACCOUNT_SID }} | |
TWILIO_API_KEY: ${{ secrets.TWILIO_API_KEY }} | |
TWILIO_API_SECRET: ${{ secrets.TWILIO_API_SECRET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
run: twilio serverless:deploy --environment ${{ github.ref_name }} > deployment_output.txt | |
- name: Update phone number voice and statusCallback urls | |
env: | |
TWILIO_ACCOUNT_SID: ${{ secrets.TWILIO_ACCOUNT_SID }} | |
TWILIO_API_KEY: ${{ secrets.TWILIO_API_KEY }} | |
TWILIO_API_SECRET: ${{ secrets.TWILIO_API_SECRET }} | |
run: | | |
voiceURL=$(grep -o 'https://[a-zA-Z0-9.-]*\.twil\.io/transcribe' deployment_output.txt) | |
statusCallbackURL=$(grep -o 'https://[a-zA-Z0-9.-]*\.twil\.io/statusCallback' deployment_output.txt) | |
declare -A branchToPhoneSid | |
branchToPhoneSid["main"]=PNd23a615664eeb581094e5e19c63fc8a4 | |
branchToPhoneSid["dev1"]=PNd1fa4d553990a47088ab733d7330a84e | |
branchToPhoneSid["dev2"]=PNffbbee3da8cbbc25cb67ecfa1ebab003 | |
curl --data-urlencode "StatusCallback=${statusCallbackURL}" \ | |
--data-urlencode "VoiceUrl=${voiceURL}" \ | |
-u "${TWILIO_API_KEY}:${TWILIO_API_SECRET}" \ | |
"https://api.twilio.com/2010-04-01/Accounts/${TWILIO_ACCOUNT_SID}/IncomingPhoneNumbers/${branchToPhoneSid[${{ github.ref_name }}]}.json" |