-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Deploy from CI
committed
May 3, 2023
0 parents
commit cf8ef1e
Showing
70 changed files
with
10,218 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Mdbook build | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
|
||
jobs: | ||
build: | ||
name: build | ||
runs-on: ubuntu-latest | ||
env: | ||
MDBOOK_VERSION: '0.4.12' | ||
MDBOOK_LINKCHECK_VERSION: '0.7.4' | ||
MDBOOK_MERMAID_VERSION: '0.8.3' | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: true | ||
- name: Install mdbook | ||
run: | | ||
mkdir ~/tools | ||
curl -L https://github.com/rust-lang/mdBook/releases/download/v$MDBOOK_VERSION/mdbook-v$MDBOOK_VERSION-x86_64-unknown-linux-gnu.tar.gz | tar xz -C ~/tools | ||
curl -L https://github.com/badboy/mdbook-mermaid/releases/download/v$MDBOOK_MERMAID_VERSION/mdbook-mermaid-v$MDBOOK_MERMAID_VERSION-x86_64-unknown-linux-gnu.tar.gz | tar xz -C ~/tools | ||
curl -L https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases/download/v$MDBOOK_LINKCHECK_VERSION/mdbook-linkcheck.v$MDBOOK_LINKCHECK_VERSION.x86_64-unknown-linux-gnu.zip -O | ||
unzip mdbook-linkcheck.v$MDBOOK_LINKCHECK_VERSION.x86_64-unknown-linux-gnu.zip -d ~/tools | ||
chmod +x ~/tools/mdbook-linkcheck | ||
curl -s https://api.github.com/repos/zjp-CN/mdbook-theme/releases/latest \ | ||
| grep browser_download_url \ | ||
| grep mdbook-theme_linux \ | ||
| cut -d '"' -f 4 \ | ||
| wget -qi - | ||
tar -xzf mdbook-theme_linux.tar.gz -C ~/tools | ||
echo ~/tools >> $GITHUB_PATH | ||
- name: Build | ||
run: mdbook build | ||
# share between different jobs | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: book | ||
path: book/ | ||
- name: Setup mdbook-theme latest | ||
run: | | ||
curl -s https://api.github.com/repos/zjp-CN/mdbook-theme/releases/latest \ | ||
| grep browser_download_url \ | ||
| grep mdbook-theme_linux \ | ||
| cut -d '"' -f 4 \ | ||
| wget -qi - | ||
tar -xvzf mdbook-theme_linux.tar.gz | ||
echo $PWD >> $GITHUB_PATH | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Deploy | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write # To push a branch | ||
pull-requests: write # To create a PR from that branch | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Install latest mdbook | ||
run: | | ||
tag=$(curl 'https://api.github.com/repos/rust-lang/mdbook/releases/latest' | jq -r '.tag_name') | ||
url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-x86_64-unknown-linux-gnu.tar.gz" | ||
mkdir mdbook | ||
curl -sSL $url | tar -xz --directory=./mdbook | ||
echo `pwd`/mdbook >> $GITHUB_PATH | ||
- name: Deploy GitHub Pages | ||
run: | | ||
# This assumes your book is in the root of your repository. | ||
# Just add a `cd` here if you need to change to another directory. | ||
mdbook build | ||
git worktree add gh-pages | ||
git config user.name "Deploy from CI" | ||
git config user.email "" | ||
cd gh-pages | ||
# Delete the ref to avoid keeping history. | ||
git update-ref -d refs/heads/gh-pages | ||
rm -rf * | ||
mv ../book/* . | ||
git add . | ||
git commit -m "Deploy $GITHUB_SHA to gh-pages" | ||
git push --force --set-upstream origin gh-pages | ||
- name: Setup mdbook-theme latest | ||
run: | | ||
curl -s https://api.github.com/repos/zjp-CN/mdbook-theme/releases/latest \ | ||
| grep browser_download_url \ | ||
| grep mdbook-theme_linux \ | ||
| cut -d '"' -f 4 \ | ||
| wget -qi - | ||
tar -xvzf mdbook-theme_linux.tar.gz | ||
echo $PWD >> $GITHUB_PATH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Simple workflow for deploying static content to GitHub Pages | ||
name: Deploy static content to Pages | ||
|
||
on: | ||
# Runs on pushes targeting the default branch | ||
push: | ||
branches: ["main"] | ||
workflow_run: | ||
workflows: ["Mdbook build"] | ||
types: | ||
- completed | ||
|
||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
# Disallow one concurrent deployment | ||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
# Single deploy job since we're just deploying | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
# actions/download-artifact@v3 does not allow sharing across workflows | ||
- name: Download artifact | ||
id: download-artifact | ||
uses: dawidd6/action-download-artifact@v2 | ||
with: | ||
name: book | ||
path: book/ | ||
workflow: build.yml | ||
- name: Setup Pages | ||
uses: actions/configure-pages@v2 | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v1 | ||
with: | ||
path: book | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
language: rust | ||
os: linux | ||
dist: xenial | ||
|
||
cache: | ||
- cargo | ||
|
||
rust: | ||
- stable | ||
|
||
before_script: | ||
- cargo install --vers "^0.4" mdbook | ||
|
||
script: | ||
# In case of custom book path: mdbook build path/to/mybook && mdbook test path/to/mybook | ||
- mdbook build && mdbook test | ||
|
||
deploy: | ||
provider: pages | ||
strategy: git | ||
edge: true | ||
cleanup: false | ||
github-token: $GITHUB_TOKEN | ||
local-dir: book # In case of custom book path: path/to/mybook/book | ||
keep-history: false | ||
on: | ||
branch: main | ||
target_branch: gh-pages |
Oops, something went wrong.