-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (59 loc) · 1.82 KB
/
main.yml
File metadata and controls
60 lines (59 loc) · 1.82 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
49
50
51
52
53
54
55
56
57
58
59
60
on:
push:
pull_request:
workflow_dispatch:
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- name: "Set vars for build only if not on main"
run: |
echo "PAGES_BRANCH=test-pages" >> $GITHUB_ENV
if: github.ref != 'refs/heads/main'
- name: "Set vars for deploy if on main"
run: |
echo "PAGES_BRANCH=gh-pages" >> $GITHUB_ENV
if: github.ref == 'refs/heads/main'
- name: 'Install cargo'
run: |
sudo apt-get update
sudo apt-get install -qy cargo
- name: "Cache cargo"
uses: actions/cache@v4
with:
path: ~/.cargo
key: cargo
- name: 'Install mdbook'
run: cargo install --locked mdbook@0.4.51 mdbook-admonish@1.20.0 mdbook-tabs@0.2.3 mdbook-svgbob@0.2.2
- name: 'Checkout'
uses: actions/checkout@master
with:
path: 'guide'
- name: 'Checkout acton repo'
uses: actions/checkout@master
with:
repository: 'actonlang/acton'
path: 'acton'
token: ${{ secrets.ACTBOT_PAT }}
- name: 'Build acton-guide'
run: |
export PATH=/.cargo/bin:$PATH
cd acton/docs/acton-guide
mdbook build -d ../../../guide-build
- name: "Configure git"
run: |
cd guide
git config --global --add safe.directory /__w/acton.guide
git config user.name "Web Bot"
git config user.email web@acton-lang.org
- name: "Create gh-pages branch from scratch"
run: |
cd guide
cp -av ../guide-build/. .
echo "acton.guide" > CNAME
git status
git checkout --orphan gh-pages
git add .
git status
git commit -a -m "Publish web page"
git push --force origin gh-pages