Debian Codegraph @

.github/workflows/website.yml

raw
1 name: Update website
2
3 concurrency:
4 group: mesonbuild.com
5 # We do NOT want `cancel-in-progress` here since only one website job
6 # should run at a time to avoid upload race conditions.
7
8 on:
9 push:
10 branches:
11 - master
12 paths:
13 - .github/workflows/website.yml
14 - docs/**
15 pull_request:
16 paths:
17 - .github/workflows/website.yml
18 - docs/**
19 workflow_dispatch:
20 release:
21 types:
22 - published
23
24 permissions:
25 contents: write # for release creation (svenstaro/upload-release-action)
26
27 # This job is copy/paster into wrapdb CI, please update it there when doing any
28 # change here.
29 jobs:
30 update_website:
31 env:
32 HAS_SSH_KEY: ${{ secrets.WEBSITE_PRIV_KEY != '' }}
33 runs-on: ubuntu-latest
34 steps:
35 - uses: actions/checkout@v4
36
37 - uses: actions/cache/restore@v4
38 id: restore-cache
39 with:
40 # should use 'pip3 cache dir' to discover this path
41 path: ~/.cache/pip
42 key: website-pip-${{ github.run_number }}
43 restore-keys: website-pip-
44
45 - name: Install package
46 run: |
47 sudo apt-get update
48 sudo apt-get -y install python3-pip ninja-build libjson-glib-dev
49 pip install hotdoc chevron strictyaml aiohttp
50
51 - uses: actions/cache/save@v4
52 with:
53 # should use 'pip3 cache dir' to discover this path
54 path: ~/.cache/pip
55 key: website-pip-${{ github.run_number }}
56
57 - name: Setup SSH Keys and known_hosts
58 env:
59 SSH_AUTH_SOCK: /tmp/ssh_agent.sock
60 run: |
61 ssh-agent -a $SSH_AUTH_SOCK > /dev/null
62 ssh-add - <<< "${{ secrets.WEBSITE_PRIV_KEY }}"
63 if: github.ref == 'refs/heads/master' && env.HAS_SSH_KEY == 'true'
64 - name: Build website
65 run: |
66 git config --global user.name "github-actions"
67 git config --global user.email "[email protected]"
68 cd docs
69 ../meson.py setup _build
70 ninja -C _build
71 ninja -C _build test
72 - name: Update website
73 env:
74 SSH_AUTH_SOCK: /tmp/ssh_agent.sock
75 run: |
76 cd docs
77 ninja -C _build upload
78 if: github.ref == 'refs/heads/master' && env.HAS_SSH_KEY == 'true'
79 - name: Release the current JSON docs
80 uses: svenstaro/upload-release-action@v2
81 with:
82 repo_token: ${{ secrets.GITHUB_TOKEN }}
83 file: docs/_build/reference_manual.json
84 tag: ${{ github.ref }}
85 if: ${{ github.event_name == 'release' }}
86 - name: Release the current man docs
87 uses: svenstaro/upload-release-action@v2
88 with:
89 repo_token: ${{ secrets.GITHUB_TOKEN }}
90 file: docs/_build/meson-reference.3
91 tag: ${{ github.ref }}
92 if: ${{ github.event_name == 'release' }}