fix(deps): update docusaurus monorepo to v3 (major) #65
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 to GitHub Pages | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- "*" | |
pull_request: | |
branches: | |
- master | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: npm | |
- name: Install dependencies | |
run: npm ci | |
- name: Build | |
run: npm run build | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build-output | |
path: build/ | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
needs: build | |
# Only deploy non-tagged builds (otherwise we deploy twice when | |
# we tag a release). | |
if: "!startsWith(github.ref, 'refs/tags/')" | |
permissions: | |
contents: write | |
steps: | |
- name: Download build artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: build-output | |
path: build/ | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
if: ${{ github.ref == 'refs/heads/master' }} | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
# Build output to publish to the `gh-pages` branch: | |
publish_dir: ./build | |
user_name: jwalton | |
user_email: [email protected] | |
pdf: | |
name: Generate PDF Version | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
needs: build | |
# Generate a new release every time there's a tag. | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- name: Download build artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: build-output | |
path: build/ | |
- name: Install Prince (HTML to PDF converter) | |
run: | | |
curl https://www.princexml.com/download/prince-14.2-linux-generic-x86_64.tar.gz -O | |
tar zxf prince-14.2-linux-generic-x86_64.tar.gz | |
cd prince-14.2-linux-generic-x86_64 | |
yes "" | sudo ./install.sh | |
- name: Start Server and Build PDF | |
run: | | |
# Symlink to make docusaurus `baseUrl` working | |
ln -s ./build rust-book-abridged | |
# Start local server and wait for it to be ready | |
npx serve . -p 1337 & npx wait-on http://localhost:1337/rust-book-abridged | |
# Generate PDF | |
npx docusaurus-prince-pdf -u http://localhost:1337/rust-book-abridged --output rust-book-abridged.pdf | |
# Kill server | |
fuser -k 1337/tcp | |
- uses: ncipollo/release-action@v1 | |
with: | |
generateReleaseNotes: true | |
makeLatest: true | |
artifacts: "rust-book-abridged.pdf" |