fuck github action
This commit is contained in:
parent
2a47813f8f
commit
3765b2bc9c
|
@ -1,56 +0,0 @@
|
|||
name: mdbook
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
- "releases/*"
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
types:
|
||||
- closed
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Git checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup mdBook
|
||||
uses: peaceiris/actions-mdbook@v1
|
||||
with:
|
||||
mdbook-version: '0.4.10'
|
||||
# mdbook-version: 'latest'
|
||||
# 安装 build pdf 依赖和中文字体
|
||||
- run: sudo apt update && sudo apt install chromium-browser wget unzip fonts-wqy-microhei ttf-wqy-zenhei -y
|
||||
# 下载 mdbook-pdf 二进制文件, 编译太花时间了
|
||||
- run: |
|
||||
export mdbook_download_url=$(curl -s 'https://api.github.com/repos/HollowMan6/mdbook-pdf/releases?per_page=1&page=1' | python3 -c "import sys, json;import pprint;tmp=[print(x['browser_download_url']) if 'x86_64-unknown-linux-gnu' in x['name'] else None for x in json.load(sys.stdin)[0]['assets']]")
|
||||
wget $mdbook_download_url
|
||||
unzip mdbook*.zip
|
||||
rm mdbook*.zip
|
||||
chmod +x mdbook-pdf
|
||||
sudo mv mdbook-pdf /bin
|
||||
# build
|
||||
- run: |
|
||||
mdbook build
|
||||
mv book/pdf/output.pdf ./Go语言高级编程.pdf
|
||||
rm -r book/pdf/ && mv book/html/* book/ && rm -r book/html
|
||||
- name: Automatic Releases
|
||||
uses: marvinpinto/action-automatic-releases@v1.2.1
|
||||
with:
|
||||
# 将 pdf 文件 release
|
||||
repo_token: ${{ secrets.MY_DEPLOY_KEY }}
|
||||
automatic_release_tag: AutoBuild
|
||||
title: Go语言高级编程PDF
|
||||
files: "Go语言高级编程.pdf"
|
||||
- name: Deploy
|
||||
uses: peaceiris/actions-gh-pages@v3
|
||||
with:
|
||||
personal_token: ${{ secrets.MY_DEPLOY_KEY }}
|
||||
publish_dir: ./book/
|
||||
publish_branch: gh-pages
|
||||
user_name: 'github-actions[bot]'
|
||||
user_email: 'github-actions[bot]@users.noreply.github.com'
|
22
Makefile
22
Makefile
|
@ -15,5 +15,27 @@
|
|||
default:
|
||||
mdbook serve
|
||||
|
||||
|
||||
build:
|
||||
-rm book
|
||||
mdbook build
|
||||
-rm book/.gitignore
|
||||
-rm book/.nojekyll
|
||||
-rm -rf book/.git
|
||||
|
||||
deploy:
|
||||
-@make clean
|
||||
mnbook build
|
||||
-rm book/.gitignore
|
||||
-rm -rf book/.git
|
||||
-rm -rf book/examples
|
||||
|
||||
cd book && git init
|
||||
cd book && git add .
|
||||
cd book && git commit -m "first commit"
|
||||
cd book && git branch -M gh-pages
|
||||
cd book && git remote add origin git@github.com:chai2010/advanced-go-programming-book.git
|
||||
cd book && git push -f origin gh-pages
|
||||
|
||||
clean:
|
||||
-rm -rf book
|
||||
|
|
Loading…
Reference in New Issue