mirror of
https://github.com/fleetdm/fleet
synced 2026-05-21 16:08:47 +00:00
Context: The "Deploy Fleet website" workflow is currently failing because the `build-storybook` step requires Node v16. <img width="1013" alt="image" src="https://github.com/fleetdm/fleet/assets/7445991/7681e11e-a94f-4a0b-8cd8-baa1ef5a37d8"> Changes: - Changed the `deploy-fleet-website` and `test-website` workflows to use Node 16. - Updated the version of `actions/setup-node` to v3 to use node 16. - added the `--legacy-peer-deps` flag to the `npm install` in the build-storybook step - Added a step to build the storybook to the `test-website` workflow. - Updated the `test-website` workflow to run when the workflow file is changed.
65 lines
2.1 KiB
YAML
65 lines
2.1 KiB
YAML
name: Test Fleet website
|
|
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- 'website/**'
|
|
- 'docs/**'
|
|
- 'handbook/**'
|
|
- 'schema/**'
|
|
- 'articles/**'
|
|
- '.github/workflows/test-website.yml'
|
|
|
|
# This allows a subsequently queued workflow run to interrupt previous runs
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id}}
|
|
cancel-in-progress: true
|
|
|
|
defaults:
|
|
run:
|
|
# fail-fast using bash -eo pipefail. See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference
|
|
shell: bash
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
matrix:
|
|
node-version: [16.x]
|
|
|
|
steps:
|
|
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v2
|
|
|
|
# Set the Node.js version
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
|
|
|
|
# Download top-level dependencies and build Storybook in the website's assets/ folder.
|
|
- run: npm install --legacy-peer-deps && npm run build-storybook -- -o ./website/assets/storybook --loglevel verbose
|
|
|
|
# Now start building!
|
|
# > …but first, get a little crazy for a sec and delete the top-level package.json file
|
|
# > i.e. the one used by the Fleet server. This is because require() in node will go
|
|
# > hunting in ancestral directories for missing dependencies, and since some of the
|
|
# > bundled transpiler tasks sniff for package availability using require(), this trips
|
|
# > up when it encounters another Node universe in the parent directory.
|
|
- run: rm -rf package.json package-lock.json node_modules/
|
|
# > Turns out there's a similar issue with how eslint plugins are looked up, so we
|
|
# > delete the top level .eslintrc file too.
|
|
- run: rm -f .eslintrc.js
|
|
|
|
# Get dependencies (including dev deps)
|
|
- run: cd website/ && npm install
|
|
|
|
# Run sanity checks
|
|
- run: cd website/ && npm test
|
|
|
|
# Compile assets
|
|
- run: cd website/ && BUILD_SCRIPT_ARGS="--githubAccessToken=${{ secrets.FLEET_RELEASE_GITHUB_PAT }}" npm run build-for-prod
|