Skip to content

Merge pull request #41 from godot-rust/feature/godot-api #197

Merge pull request #41 from godot-rust/feature/godot-api

Merge pull request #41 from godot-rust/feature/godot-api #197

Workflow file for this run

# Copyright (c) godot-rust; Bromeon and contributors.
# 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: "Book CI"
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.37"
MDBOOK_TOC_VERSION: "0.14.2"
MDBOOK_ADMONISH_VERSION: "1.15.0"
MDBOOK_BIN: "/tmp/mdbook-bin"
OXIPNG_VERSION: "9.0.0"
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write # git push for oxipng
pages: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v4
# 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:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Install markdownlint-cli2"
run: npm install -g markdownlint-cli2
- name: "Run lint"
run: ./lint.sh
# Disabled because behavior differs slightly from markdownlint (cli)
# - name: "Run lint"
# uses: docker://avtodev/markdown-lint:v1 # fastest way; alternative: avto-dev/markdown-lint@v1
# with:
# args: ReadMe.md "src/**/*.md"
# config: .github/other/.markdownlint.jsonc
license-guard:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- 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
oxipng:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
- name: "Run oxipng to reduce PNG sizes"
run: |
wget https://github.com/shssoichiro/oxipng/releases/download/v${OXIPNG_VERSION}/oxipng-${OXIPNG_VERSION}-x86_64-unknown-linux-musl.tar.gz \
-O /tmp/oxipng.tar.gz
tar -xvzf /tmp/oxipng.tar.gz -C /tmp
mv /tmp/oxipng-${OXIPNG_VERSION}-x86_64-unknown-linux-musl/oxipng ./oxipng
chmod +x ./oxipng
./oxipng --version
./oxipng --strip safe --alpha -r src
# See https://github.com/EndBug/add-and-commit#add--commit.
- name: "Commit changes"
uses: EndBug/add-and-commit@v9
with:
author_name: 'Godot-Rust Automation'
author_email: '[email protected]'
message: 'Auto-reduce PNG sizes'
add: 'src/**/*.png'