mirror of
https://github.com/cheeriojs/cheerio.git
synced 2026-02-25 23:25:17 +00:00
70 lines
1.6 KiB
YAML
70 lines
1.6 KiB
YAML
name: Deploy website to GitHub Pages
|
|
|
|
# Based on https://raw.githubusercontent.com/actions/starter-workflows
|
|
|
|
on:
|
|
# Runs on pushes targeting the main branch
|
|
push:
|
|
branches: [main]
|
|
|
|
# Allows you to run this workflow manually from the Actions tab
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
FORCE_COLOR: 2
|
|
|
|
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
|
permissions:
|
|
contents: read
|
|
pages: write
|
|
id-token: write
|
|
|
|
# Allow one concurrent deployment
|
|
concurrency:
|
|
group: 'pages'
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
# Build job
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v6.2.0
|
|
with:
|
|
# Use current Node LTS version
|
|
node-version: lts/*
|
|
cache: 'npm'
|
|
- name: Setup Pages
|
|
id: pages
|
|
uses: actions/configure-pages@v5
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
- name: Build
|
|
run: npm run build
|
|
- name: Install website dependencies
|
|
working-directory: website
|
|
run: npm ci
|
|
- name: Build docs
|
|
working-directory: website
|
|
run: npm run build
|
|
- name: Upload artifact
|
|
uses: actions/upload-pages-artifact@v4
|
|
with:
|
|
path: ./website/dist
|
|
|
|
# Deployment job
|
|
deploy:
|
|
environment:
|
|
name: github-pages
|
|
url: ${{ steps.deployment.outputs.page_url }}
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
if: ${{github.repository == 'cheeriojs/cheerio'}}
|
|
steps:
|
|
- name: Deploy to GitHub Pages
|
|
id: deployment
|
|
uses: actions/deploy-pages@v4
|