Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 41 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ on:
tags:
- 'v*.*.*'
workflow_dispatch:
inputs:
version_name:
description: 'Version name (e.g., 1.0.0)'
required: true

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
Expand All @@ -23,26 +28,57 @@ env:
jobs:
deploy:
name: Deploy to GitHub Pages
environment:
name: Deploy to GitHub Pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install dependencies
run: yarn install --frozen-lockfile --non-interactive
- name: Determine Version Name
id: determine_version
run: |
if [ -n "${{ github.event.inputs.version_name }}" ]; then
echo "::set-output name=version_name::${{ github.event.inputs.version_name }}"
else
echo "::set-output name=version_name::${{ github.ref_name }}"
fi
- name: Publish new version
run: yarn docusaurus docs:version ${{ github.ref_name }}
run: yarn docusaurus docs:version ${{ steps.determine_version.outputs.version_name }}
- name: Build
run: yarn build
- name: Setup Pages
uses: actions/configure-pages@v1
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
# Upload entire repository
# Use the build artifacts
path: build
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1

generate_pdf:
name: Generate PDF from Deployed Site
runs-on: ubuntu-latest
needs: deploy
steps:
- name: Wait for deployment
run: echo "Deployment finished"
- name: Checkout
uses: actions/checkout@v3
- name: Install dependencies
run: yarn install --frozen-lockfile --non-interactive
- name: Install Prince
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: Generate PDF
run: npx docusaurus-prince-pdf -u https://nubeio.github.io/rubix-ce-docs/docs/overview --include-index --output pdf/rubix-ce.pdf
- name: Upload PDF
uses: actions/upload-artifact@v3
with:
name: pdf
path: pdf/rubix-ce.pdf
if-no-files-found: error
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

# Production
/build
/pdf

.idea
# Generated files
Expand Down
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,20 @@ Example
cd /home/aidan/code/go/rubix-ce-docs/docs/rubix-ce/services
sed -i -e 's/####/###/g' rql.md
```

## Generate PDF

To generate PDF from a local Docusaurus instance. You need to first build the site locally:

# Build the site
```bash
yarn build
```

# Serve built site locally
```bash
yarn serve
```

# Generate PDF from local Docusaurus instance
npx docusaurus-prince-pdf -u http://localhost:3000/rubix-ce-docs/docs/overview --include-index --output pdf/rubix-ce.pdf
Loading