diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..6097259 --- /dev/null +++ b/.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 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..e0c9488 --- /dev/null +++ b/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 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/guide/css/custom.css b/guide/css/custom.css new file mode 100644 index 0000000..7a20fec --- /dev/null +++ b/guide/css/custom.css @@ -0,0 +1,7 @@ +body { + font-size: 1.8rem; +} + +.chapter li.chapter-item { + line-height: 1.8em; +} diff --git a/package.json b/package.json index 732d051..673a0a7 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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": {