Deploy GitHub Pages #6
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: Deploy GitHub Pages | |
on: | |
workflow_dispatch: | |
env: | |
GITHUB_SERVICE_USER: "Microsoft FAST Builds" | |
GITHUB_SERVICE_EMAIL: "[email protected]" | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node: [20.x] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
fetch-depth: 0 | |
- name: Set Git User | |
run: | | |
git config --global user.name "${{ env.GITHUB_SERVICE_USER }}" | |
git config --global user.email "${{ env.GITHUB_SERVICE_EMAIL }}" | |
- name: Cache multiple paths | |
uses: actions/cache@v2 | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Install package dependencies | |
run: npm ci | |
- name: Build workspaces | |
run: npm run build | |
- name: Build GitHub Pages | |
run: npm run build:gh-pages | |
- name: Deploy GitHub Pages | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
token: ${{ secrets.GH_TOKEN }} | |
branch: gh-pages # The branch the action should deploy to. | |
folder: sites/website/build # The folder the action should deploy. | |
target-folder: docs # The folder on the branch to deploy to. | |
clean: true # Remove old files to clean up unique hash files. | |
single-commit: true # Only use a single commit to keep the branch free from git history. |