Add invite cutomers tutorial #168
Workflow file for this run
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
on: push | |
name: Build | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Run docker-compose | |
run: | | |
docker-compose up -d | |
- name: Bootstrap DB | |
id: bootstrap_db | |
run: | | |
output=$(docker-compose run -T somleng bundle exec rails db:setup) | |
account_sid=$(echo $output | grep -Po 'Account\s+SID:\s+\K\b[a-zA-Z0-9-]+\b') | |
auth_token=$(echo $output | grep -Po 'Auth\s+Token:\s+\K\b[a-zA-Z0-9_-]+\b') | |
echo "account_sid=$account_sid" >> $GITHUB_OUTPUT | |
echo "auth_token=$auth_token" >> $GITHUB_OUTPUT | |
- name: Test an outbound call | |
run: | | |
curl --fail -s -X "POST" "http://api.lvh.me:3000/2010-04-01/Accounts/${{ steps.bootstrap_db.outputs.account_sid }}/Calls" \ | |
-H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ | |
-u "${{ steps.bootstrap_db.outputs.account_sid }}:${{ steps.bootstrap_db.outputs.auth_token }}" \ | |
--data-urlencode "Url=https://demo.twilio.com/docs/voice.xml" \ | |
--data-urlencode "Method=GET" \ | |
--data-urlencode "To=+299221234" \ | |
--data-urlencode "From=1294" | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
needs: build | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} | |
role-skip-session-tagging: true | |
role-duration-seconds: 3600 | |
aws-region: ap-southeast-1 | |
- name: Deploy Website | |
run: | | |
aws s3 sync --acl public-read --exclude "*" --include "*.html" --content-type "text/html; charset=utf-8" public/website s3://www.somleng.org | |
aws s3 sync --acl public-read --exclude "*.html" public/website s3://www.somleng.org | |
- name: Invalidate Cache | |
run: aws cloudfront create-invalidation --distribution-id E3962XCJFZ0KB1 --paths /\* | |