From 38a52c70cb4b0e902d5d8536ff9f49b02b8723ec Mon Sep 17 00:00:00 2001 From: Francesco Lodolo Date: Thu, 11 Jan 2024 20:01:00 +0100 Subject: [PATCH] Switch from gitbook to mdbook --- .github/workflows/deploy.yml | 35 +++++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 10 ++++++---- .nojekyll | 0 book.toml | 11 +++++++++++ guide/SUMMARY.md | 1 + package.json | 5 ++--- 6 files changed, 55 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/deploy.yml create mode 100644 .nojekyll create mode 100644 book.toml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..174649d --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,35 @@ +name: Deploy to GitHub Pages + +on: + # Triggers the workflow on push or pull request events but + # only for the default branch. + push: + branches: + - master + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + fetch: + runs-on: ubuntu-latest + steps: + - name: Clone repository + uses: actions/checkout@v4 + - name: Install Rust packages + run: | + curl --proto '=https' --tlsv1.2 -sSf https://rossmacarthur.github.io/install/crate.sh | bash -s -- --repo "rust-lang/mdBook" --bin mdbook --to ~/.cargo/bin + - 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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dadb8a9..811d28d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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: @@ -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 diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/book.toml b/book.toml new file mode 100644 index 0000000..6afe981 --- /dev/null +++ b/book.toml @@ -0,0 +1,11 @@ +[book] +multilingual = false +src = "guide" + +[build] +build-dir = "build" +create-missing = false + +[output.html] +git-repository-url = "https://github.com/projectfluent/fluent/" +edit-url-template = "https://github.com/projectfluent/fluent/edit/master/{path}" diff --git a/guide/SUMMARY.md b/guide/SUMMARY.md index 9c22623..c83fdd5 100644 --- a/guide/SUMMARY.md +++ b/guide/SUMMARY.md @@ -1,5 +1,6 @@ # Summary +* [Introduction](README.md) * [Hello, world!](hello.md) * [Writing Text](text.md) * [Placeables](placeables.md) diff --git a/package.json b/package.json index 732d051..8a8712e 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "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", @@ -40,8 +40,7 @@ "eslint": "^6.7.2", "@fluent/bundle": "^0.14.0", "@fluent/syntax": "^0.14.0", - "gh-pages": "^2.1.1", - "gitbook-cli": "^2.3.2", + "gh-pages": "^6.1.1", "json-diff": "^0.5.4" }, "dependencies": {