Skip to content

Commit

Permalink
Switch from gitbook to mdbook
Browse files Browse the repository at this point in the history
  • Loading branch information
flodolo committed Jan 22, 2024
2 parents feffc72 + 1f551d1 commit 4ea5c7a
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 8 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/deploy.yml
@@ -0,0 +1,43 @@
name: Deploy to GitHub Pages

on:
# Triggers the workflow on push or pull request events but
# only for the default branch.
push:
branches:
- master
paths:
- '.github/workflows/deploy.yml'
- 'book.toml'
- 'guide/**'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
fetch:
runs-on: ubuntu-latest
env:
MDBOOK_VERSION: v0.4.36
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Install mdbook
run: |
mkdir installed-bins
curl -Lf "https://github.com/rust-lang/mdBook/releases/download/$MDBOOK_VERSION/mdbook-$MDBOOK_VERSION-x86_64-unknown-linux-gnu.tar.gz" | tar -xz --directory=./installed-bins
echo `pwd`/installed-bins >> $GITHUB_PATH
- name: Install gh-pages
run: |
npm install gh-pages@"~6.1.1"
- name: Build book
run: |
mdbook --version
mdbook build
- name: Set Git config
run: |
git config --global user.email "actions@users.noreply.github.com"
git config --global user.name 'Automation'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
- name: Deploy to GitHub pages
run: |
npx gh-pages --message "Deploy docs" --no-history --dist build
10 changes: 6 additions & 4 deletions .github/workflows/test.yml
Expand Up @@ -3,9 +3,11 @@ name: Run tests
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
branches:
- master
pull_request:
branches: [ master ]
branches:
- master
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

Expand All @@ -14,8 +16,8 @@ jobs:
name: Run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '12'
- name: Run ci
Expand Down
Empty file added .nojekyll
Empty file.
13 changes: 13 additions & 0 deletions book.toml
@@ -0,0 +1,13 @@
[book]
multilingual = false
src = "guide"

[build]
build-dir = "build"
create-missing = false

[output.html]
additional-css = ["guide/css/custom.css"]
edit-url-template = "https://github.com/projectfluent/fluent/edit/master/{path}"
git-repository-url = "https://github.com/projectfluent/fluent/"
no-section-label = true
1 change: 1 addition & 0 deletions guide/SUMMARY.md
@@ -1,5 +1,6 @@
# Summary

* [Introduction](README.md)
* [Hello, world!](hello.md)
* [Writing Text](text.md)
* [Placeables](placeables.md)
Expand Down
7 changes: 7 additions & 0 deletions guide/css/custom.css
@@ -0,0 +1,7 @@
body {
font-size: 1.8rem;
}

.chapter li.chapter-item {
line-height: 1.8em;
}
5 changes: 1 addition & 4 deletions package.json
Expand Up @@ -5,11 +5,10 @@
"private": true,
"scripts": {
"bench": "node -r esm ./test/bench.js ./test/benchmarks/gecko_strings.ftl",
"build:guide": "gitbook build guide build/guide",
"build:guide": "mdbook build",
"build": "npm run --silent build:guide",
"ci": "npm run --silent lint && npm test && npm run --silent test:ebnf && npm run --silent test:validate",
"clean": "rm -rf build",
"deploy": "gh-pages -d build",
"generate:ebnf": "node -r esm bin/ebnf.js ./syntax/grammar.js > ./spec/fluent.ebnf",
"generate:fixtures": "make -sC test/fixtures",
"generate": "npm run --silent generate:ebnf && npm run --silent generate:fixtures",
Expand Down Expand Up @@ -40,8 +39,6 @@
"eslint": "^6.7.2",
"@fluent/bundle": "^0.14.0",
"@fluent/syntax": "^0.14.0",
"gh-pages": "^2.1.1",
"gitbook-cli": "^2.3.2",
"json-diff": "^0.5.4"
},
"dependencies": {
Expand Down

0 comments on commit 4ea5c7a

Please sign in to comment.