fix security warnings (#808) #1525
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: Website | |
on: | |
pull_request: | |
branches: [main] | |
paths: | |
- 'packages/website/**' | |
- '.github/**' | |
- 'package.json' | |
- 'yarn.lock' | |
push: | |
branches: [main] | |
paths: | |
- 'packages/website/**' | |
- '.github/**' | |
- 'package.json' | |
- 'yarn.lock' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: volta-cli/action@v4 | |
- name: restore lerna | |
uses: actions/cache@v3 | |
with: | |
path: | | |
node_modules | |
*/*/node_modules | |
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} | |
- run: yarn | |
- name: Build | |
run: yarn lerna run build --scope website | |
- name: Lint | |
run: yarn lerna run lint --scope website | |
- name: Test | |
run: yarn lerna run test:jest --scope website | |
- name: Cypress | |
uses: cypress-io/github-action@v6 | |
with: | |
working-directory: packages/website | |
start: yarn test:cypress | |
browser: chrome | |
wait-on: 'http://localhost:8000' | |
wait-on-timeout: 120 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
os-compatibility: | |
needs: build | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: | |
# - macos-latest | |
- windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: volta-cli/action@v4 | |
- name: restore lerna | |
uses: actions/cache@v3 | |
with: | |
path: | | |
node_modules | |
*/*/node_modules | |
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} | |
- run: yarn config set network-timeout 300000 | |
- run: yarn | |
- name: Build | |
run: yarn lerna run build --scope website | |
- name: Test | |
run: yarn lerna run test:jest --scope website | |
node-compatibility: | |
needs: build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.x] | |
# node-version: [16.x, 18.x, 20.x] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: volta-cli/action@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: restore lerna | |
uses: actions/cache@v3 | |
with: | |
path: | | |
node_modules | |
*/*/node_modules | |
key: ${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} | |
- run: yarn | |
- name: Build | |
run: yarn lerna run build --scope website | |
- name: Test | |
run: yarn lerna run test:jest --scope website | |
- name: Cypress | |
uses: cypress-io/github-action@v6 | |
with: | |
working-directory: packages/website | |
start: yarn test:cypress | |
browser: chrome | |
wait-on: 'http://localhost:8000' | |
wait-on-timeout: 120 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
ts-compatibility: | |
needs: build | |
runs-on: ubuntu-latest | |
continue-on-error: ${{ matrix.experimental }} | |
strategy: | |
matrix: | |
typescript-version: ['~5.1.0', ~5.2.0, latest, next, beta, rc] | |
include: | |
- typescript-version: '~5.1.0' | |
experimental: false | |
name: 'ts-5.1' | |
- typescript-version: '~5.2.0' | |
experimental: false | |
name: 'ts-5.2' | |
- typescript-version: latest | |
experimental: false | |
name: 'ts-stable' | |
- typescript-version: beta | |
experimental: false | |
name: 'ts-beta' | |
- typescript-version: rc | |
experimental: true | |
name: 'ts-rc' | |
- typescript-version: next | |
experimental: true | |
name: 'ts-canary' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: volta-cli/action@v4 | |
- name: restore lerna | |
uses: actions/cache@v3 | |
with: | |
path: | | |
node_modules | |
*/*/node_modules | |
key: ${{ runner.os }}-${{ matrix.typescript-version }}-${{ hashFiles('**/yarn.lock') }} | |
- run: yarn | |
- name: Installing TypeScript ${{ matrix.typescript-version }} | |
run: | | |
yarn workspace website add -D typescript@${{ matrix.typescript-version}} | |
yarn workspace hello-ts add -D typescript@${{ matrix.typescript-version}} | |
- name: Build | |
run: yarn lerna run build --scope website | |
- name: TypeScript compile | |
run: | | |
yarn replace-in-file 'import chalk' 'import * as chalk' node_modules/gatsby-cli/lib/reporter/reporter.d.ts | |
yarn lerna run typecheck --scope website | |
- name: Test | |
run: yarn lerna run test:jest --scope website | |
- name: Cypress | |
uses: cypress-io/github-action@v6 | |
with: | |
working-directory: packages/website | |
start: yarn test:cypress | |
browser: chrome | |
wait-on: 'http://localhost:8000' | |
wait-on-timeout: 120 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
publish: | |
needs: [build, os-compatibility, node-compatibility, ts-compatibility] | |
runs-on: ubuntu-latest | |
if: success() && github.ref == 'refs/heads/main' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: volta-cli/action@v4 | |
- run: yarn | |
- name: Build | |
run: yarn lerna run build-prod --scope website | |
- uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.ACCESS_TOKEN }} | |
publish_dir: ./packages/website/public | |
cname: www.typescript-training.com | |