-
Notifications
You must be signed in to change notification settings - Fork 1
48 lines (44 loc) · 1.51 KB
/
deploy.yml
File metadata and controls
48 lines (44 loc) · 1.51 KB
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
name: DispachedDeployBook
on:
repository_dispatch:
types: [updated_book]
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: |
echo "payload Foo '${{ github.event.client_payload.foo }}'"
pwd
ls
git config --global user.name "Deploy book from CI into github page"
git config --global user.email ""
ssh-agent sh -c 'echo "${{ secrets.GH_PAGE_ACTION_READ }}" | ssh-add - && git clone git@github.com:HyperAST/HyperAST.git'
cd HyperAST/book
mdbook build
cd ../..
# Delete the ref to avoid keeping history.
git update-ref -d refs/heads/master
pwd
ls
rm -rf docs/book/*
ls docs
mv HyperAST/book/book/* docs/book/
rm -rf HyperAST
rm -rf mdbook
git add .
git commit -m "Deploy $GITHUB_SHA to HyperAST.github.io"
git push --force