-
Notifications
You must be signed in to change notification settings - Fork 47
124 lines (102 loc) · 4.39 KB
/
cd.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# 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.40"
MDBOOK_TOC_VERSION: "0.14.2"
MDBOOK_ADMONISH_VERSION: "1.17.1"
MDBOOK_BIN: "/tmp/mdbook-bin"
OXIPNG_VERSION: "9.1.1"
MARKDOWNLINT_CLI2_VERSION: "0.13.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@v3
with:
path: book
- name: "Deploy to GitHub Pages"
if: github.ref == 'refs/heads/master'
uses: actions/deploy-pages@v4
markdown-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Install markdownlint-cli2"
run: npm install -g markdownlint-cli2@$MARKDOWNLINT_CLI2_VERSION
- 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
permissions:
contents: write
pull-requests: write
repository-projects: write
checks: write
steps:
- uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
#token: ${{ secrets.PR_PUSH_TOKEN }}
# Dispatch workflow
- uses: benc-uk/workflow-dispatch@v1
with:
#token: ${{ secrets.GITHUB_TOKEN }}
workflow: 'push-oxipng-image.yml'
inputs: '{ "repository": "${{ github.event.pull_request.head.repo.full_name }}", "branch": "${{ github.event.pull_request.head.ref }}" }'