Skip to content

Workflow file for this run

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
name: "Deploy to GitHub Pages"
on:
push:
# branches: [master]
pull_request:
env:
# Use fixed versions for now, replace with 'latest' to auto-use latest
# Note: during build, there's a warning when using mdbook-toc compiled against an older mdbook version, should work though.
MDBOOK_VERSION: "0.4.32"
MDBOOK_TOC_VERSION: "0.13.0"
MDBOOK_ADMONISH_VERSION: "1.10.1"
MDBOOK_BIN: "/tmp/mdbook-bin"
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
# contents: read
contents: write
pages: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v3
# Note: actions-rs/[email protected] was considered, but a full 'cargo install' is unnecessarily slow and the cache mechanism is not reliable
# (error "Unable to download mdbook == 0.4.14 from the tool cache: Error: Unexpected HTTP response: 403")
# So, directly pull the release from GitHub
- name: "Install mdbook, mdbook-toc, mdbook-admonish"
run: |
wget https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz \
-O /tmp/mdbook.tar.gz
wget https://github.com/badboy/mdbook-toc/releases/download/${MDBOOK_TOC_VERSION}/mdbook-toc-${MDBOOK_TOC_VERSION}-x86_64-unknown-linux-gnu.tar.gz \
-O /tmp/mdbook-toc.tar.gz
wget https://github.com/tommilligan/mdbook-admonish/releases/download/v${MDBOOK_ADMONISH_VERSION}/mdbook-admonish-v${MDBOOK_ADMONISH_VERSION}-x86_64-unknown-linux-gnu.tar.gz \
-O /tmp/mdbook-admonish.tar.gz
mkdir ${MDBOOK_BIN}
echo ${MDBOOK_BIN} >> $GITHUB_PATH
tar -xvzf /tmp/mdbook.tar.gz -C ${MDBOOK_BIN}
tar -xvzf /tmp/mdbook-toc.tar.gz -C ${MDBOOK_BIN}
tar -xvzf /tmp/mdbook-admonish.tar.gz -C ${MDBOOK_BIN}
- name: "Build book"
run: mdbook build
- name: "Upload Pages artifact"
if: github.ref == 'refs/heads/master'
uses: actions/upload-pages-artifact@v1
with:
path: book
- name: "Deploy to GitHub Pages"
if: github.ref == 'refs/heads/master'
uses: actions/deploy-pages@v2
markdown-lint:
name: "Lint all .md files"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: "Run lint"
uses: docker://avtodev/markdown-lint:v1 # fastest way
# uses: avto-dev/markdown-lint@v1
with:
args: '.'
config: .github/other/.markdownlint.jsonc
license-guard:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: "Check license headers"
uses: apache/skywalking-eyes/[email protected]
with:
# log: debug # optional: set the log level. The default value is `info`.
config: .github/other/licenserc.yml
# token: # optional: the token that license eye uses when it needs to comment on the pull request.
# Set to empty ("") to disable commenting on pull request. The default value is ${{ github.token }}
# mode: # optional: Which mode License-Eye should be run in. Choices are `check` or `fix`. The default value is `check`.
mode: check
# mode: fix
# - name: "Commit changes"
# uses: EndBug/add-and-commit@v9
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# author_name: 'Godot-Rust Automation'
# author_email: '[email protected]'
# message: 'Auto-apply license headers'