Skip to content

Change from yarn to npm, run nx migration, and fix the resulting issues. #328

Change from yarn to npm, run nx migration, and fix the resulting issues.

Change from yarn to npm, run nx migration, and fix the resulting issues. #328

Workflow file for this run

name: deploy demo app for PR preview
on:
pull_request:
branches: ['main']
jobs:
main:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
steps:
- name: Checkout the codebase
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
# Cache node_modules to speed up future builds
# For more info see: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows
- name: Cache node modules
id: cache-nodemodules
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json', '**/package.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
# Only install dependencies if cached dependencies aren't found (applies when content of package-lock.json or any package.json changes)
- name: Install Dependencies
if: ${{ steps.cache-nodemodules.outputs.cache-hit != 'true' }}
run: npm ci
- name: Validate tokens
id: validate-tokens
run: |
# Parse and Validate Design Tokens
npm run tokens:ci
- name: Build Demo App
run: npx nx run demo:build --skip-nx-cache
- name: Lint
run: npm run lint:ci
- name: Configure AWS credentials for deployment
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: us-east-1
## Deploy remix demo app with SST
- name: Deploy Demo App to AWS
run: npx sst deploy --stage radius-pr
# Find existing Demo App comment
- name: Find Existing Comment
uses: peter-evans/find-comment@v2
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Demo App Preview
# Create new comment with Demo App URL, if one does not exist already
- name: Comment on PR with link to deployed demo app
if: steps.fc.outputs.comment-id == ''
uses: peter-evans/create-or-update-comment@v2
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
Demo App Preview: https://d11mwnosflssyy.cloudfront.net/