mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-18 12:06:43 +00:00
Add workflow to update the website for the book automatically
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
fad1e42e56
commit
c7b7e2473f
42
.github/workflows/update-website.yml
vendored
Normal file
42
.github/workflows/update-website.yml
vendored
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
name: Update Website
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- 'docs/**'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build_and_deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 15
|
||||||
|
container: asterinas/asterinas:0.4.0
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
repository: 'asterinas/asterinas'
|
||||||
|
path: 'asterinas'
|
||||||
|
|
||||||
|
- name: Build the website
|
||||||
|
run: |
|
||||||
|
cd asterinas/docs
|
||||||
|
mdbook build
|
||||||
|
|
||||||
|
- name: Deploy website
|
||||||
|
env:
|
||||||
|
BOOK_PUBLISH_KEY: ${{ secrets.BOOK_PUBLISH_KEY }}
|
||||||
|
run: |
|
||||||
|
echo "$BOOK_PUBLISH_KEY " > ./book_publish_key
|
||||||
|
chmod 600 ./book_publish_key
|
||||||
|
ssh-keyscan -t rsa github.com >> ./known_hosts
|
||||||
|
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
|
git config --global user.name "github-actions[bot]"
|
||||||
|
GIT_SSH_COMMAND="ssh -i ./book_publish_key -o UserKnownHostsFile=./known_hosts" git clone git@github.com:asterinas/book.git temp_book
|
||||||
|
cd temp_book
|
||||||
|
git checkout --orphan newBranch
|
||||||
|
git add -A
|
||||||
|
git commit -am "Update website"
|
||||||
|
git branch -D main
|
||||||
|
git branch -m main
|
||||||
|
GIT_SSH_COMMAND="ssh -i ../book_publish_key -o UserKnownHostsFile=../known_hosts" git push -f origin main
|
Reference in New Issue
Block a user