don't package src #391
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: Update, Build and Deploy auth0 example | |
on: | |
release: | |
types: [published] | |
push: | |
branches: [master] | |
jobs: | |
auth0-react-app: | |
strategy: | |
matrix: | |
node: ["18.x"] | |
os: [ubuntu-latest] | |
demo: [auth0-react-app] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Check out Git repository | |
if: ((github.event_name == 'release') || (github.event_name == 'push' && contains(github.event.head_commit.message, '[deploy-demos]'))) | |
uses: actions/checkout@v3 | |
- name: Set up node | |
if: ((github.event_name == 'release') || (github.event_name == 'push' && contains(github.event.head_commit.message, '[deploy-demos]'))) | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node }} | |
registry-url: "https://registry.npmjs.org" | |
cache: "npm" | |
- name: Build ${{ matrix.demo }} demo | |
if: ((github.event_name == 'release') || (github.event_name == 'push' && contains(github.event.head_commit.message, '[deploy-demos]'))) | |
run: | | |
npm i -g npm-check-updates | |
cd demo/${{ matrix.demo }}/app | |
ncu -u --target=minor | |
ncu -u "/^@web3auth.*$/" | |
npm install | |
npm run build | |
- name: Commit Changes | |
if: ((github.event_name == 'release') || (github.event_name == 'push' && contains(github.event.head_commit.message, '[deploy-demos]'))) | |
uses: EndBug/add-and-commit@v9 # You can change this to use a specific version. | |
with: | |
push: origin HEAD:master | |
author_name: Torus Bot | |
author_email: no-reply@tor.us | |
default_author: user_info | |
# The way the action should handle pathspec errors from the add and remove commands. Three options are available: | |
# - ignore -> errors will be logged but the step won't fail | |
# - exitImmediately -> the action will stop right away, and the step will fail | |
# - exitAtEnd -> the action will go on, every pathspec error will be logged at the end, the step will fail. | |
# Default: ignore | |
pathspec_error_handling: | |
exitImmediately | |
# Set the credentials from repository settings/secrets | |
- name: Configure AWS credentials | |
if: ((github.event_name == 'release') || (github.event_name == 'push' && contains(github.event.head_commit.message, '[deploy-demos]'))) | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_REGION_US }} | |
# Copy the files from build folder to the S3 bucket | |
# Upload to S3 | |
- name: sync s3 | |
if: ((github.event_name == 'release') || (github.event_name == 'push' && contains(github.event.head_commit.message, '[deploy-demos]'))) | |
uses: jakejarvis/s3-sync-action@master | |
env: | |
SOURCE_DIR: "./demo/auth0-react-app/app/build" | |
AWS_REGION: "us-east-1" | |
AWS_S3_BUCKET: "demo-auth0.web3auth.io" | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
# Invalidate Cloudfront (this action) | |
- name: invalidate | |
if: ((github.event_name == 'release') || (github.event_name == 'push' && contains(github.event.head_commit.message, '[deploy-demos]'))) | |
uses: chaitanyapotti/cloudfront-update-distribution@v2 | |
with: | |
cloudfront-distribution-id: ${{ secrets.AWS_CLOUDFRONT_AUTH0_DEMO_DISTRIBUTION_ID }} | |
cloudfront-invalidation-path: "/*" | |
cloudfront-invalidation-required: true | |
cloudfront-wait-for-service-update: false |