|
1 | | -# workflow for rendering and uploads webxdc docs |
2 | 1 |
|
3 | | -name: Render and upload webxdc docs |
| 2 | +name: Render docs and upload website to webxdc.org |
4 | 3 |
|
5 | | -# Controls when the workflow will run |
6 | 4 | on: |
7 | | - # Triggers the workflow on push or pull request events but only for the master branch |
8 | 5 | push: |
9 | | - branches: |
10 | | - - main |
11 | | - |
12 | | - # Allows you to run this workflow manually from the Actions tab |
| 6 | + branches: |
| 7 | + - '**' |
| 8 | + pull_request: |
13 | 9 | workflow_dispatch: |
14 | 10 |
|
15 | | -# A workflow run is made up of one or more jobs that can run sequentially or in parallel |
16 | 11 | jobs: |
17 | | - # This workflow contains a single job called "build" |
18 | 12 | build: |
19 | | - # The type of runner that the job will run on |
20 | 13 | runs-on: ubuntu-latest |
21 | 14 |
|
22 | | - # Steps represent a sequence of tasks that will be executed as part of the job |
23 | 15 | steps: |
24 | | - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
25 | | - - uses: actions/checkout@v2 |
| 16 | + - uses: actions/checkout@v6 |
26 | 17 |
|
27 | | - - uses: actions-rs/toolchain@v1 |
28 | | - with: |
29 | | - profile: minimal |
30 | | - toolchain: stable |
31 | | - override: true |
| 18 | + - name: Download and setup mdbook |
| 19 | + run: | |
| 20 | + MDBOOK_VERSION="0.4.40" |
| 21 | + curl -sSL "https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz" | tar -xz |
| 22 | + sudo mv mdbook /usr/local/bin/ |
32 | 23 |
|
33 | | - - name: Rust Cache |
34 | | - uses: Swatinem/rust-cache@v1.3.0 |
| 24 | + # Michael-F-Bryan is the original author, see github link on https://crates.io/crates/mdbook-linkcheck |
| 25 | + - name: Install mdbook-linkcheck |
| 26 | + run: | |
| 27 | + curl -sSL "https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases/download/v0.7.7/mdbook-linkcheck.x86_64-unknown-linux-gnu.zip" -o mdbook-linkcheck.zip |
| 28 | + unzip mdbook-linkcheck.zip mdbook-linkcheck |
| 29 | + chmod +x mdbook-linkcheck |
| 30 | + sudo mv mdbook-linkcheck /usr/local/bin/ |
35 | 31 |
|
36 | | - - name: install mdbook |
| 32 | + - name: Build docs and prepare website/ contents |
37 | 33 | run: | |
38 | | - cargo install mdbook --vers "^0.4" |
39 | | - cargo install mdbook-linkcheck |
40 | 34 | cd src-docs |
41 | 35 | mdbook build |
42 | 36 | mv book/html ../website/docs |
| 37 | + cd .. |
| 38 | + mv apps website/ |
43 | 39 |
|
44 | | - - name: Upload website including docs and apps |
| 40 | + - name: Upload website/ to webxdc.org |
| 41 | + if: github.ref == 'refs/heads/main' && github.event_name == 'push' |
45 | 42 | run: | |
46 | 43 | mkdir -p "$HOME/.ssh" |
47 | 44 | echo "${{ secrets.KEY }}" > "$HOME/.ssh/key" |
48 | 45 | chmod 600 "$HOME/.ssh/key" |
49 | | - mv apps website/ |
50 | 46 | rsync -avzh -e "ssh -i $HOME/.ssh/key -o StrictHostKeyChecking=no" "website/" "${{ secrets.USERNAME }}@delta.chat:/var/www/html/webxdc.org" |
0 commit comments