add some configs #3
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: Staging from Main | |
on: | |
push: | |
branches: | |
- main | |
# TODO: id-token: write is needed for configure-aws-credentials | |
# but it seems to wipe out all other permissions and breaks other steps | |
permissions: write-all | |
jobs: | |
deploy_staging: | |
name: Deploy to Staging | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
cache: 'npm' | |
- name: Install npm dependencies | |
run: npm ci | |
- name: Run Tests | |
run: npm run test:ci | |
- name: Build library | |
run: npm run build:all | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-region: us-east-1 | |
role-to-assume: arn:aws:iam::089941056973:role/github-actions-apptentive-javascript | |
- name: Deploy to production | |
run: npm run deploy:staging | |
- name: Invalidate CloudFront | |
uses: chetan/invalidate-cloudfront-action@v2 | |
env: | |
DISTRIBUTION: ${{ secrets.CF_DISTRIBUTION_ID }} | |
PATHS: '/staging/ /next/' |