1
+ # Workflow to build your docs with oranda (and mdbook)
2
+ # and deploy them to Github Pages
3
+ name : Web
4
+
5
+ # We're going to push to the gh-pages branch, so we need that permission
6
+ permissions :
7
+ contents : write
8
+
9
+ # What situations do we want to build docs in?
10
+ # All of these work independently and can be removed / commented out
11
+ # if you don't want oranda/mdbook running in that situation
12
+ on :
13
+ # Check that a PR didn't break docs!
14
+ #
15
+ # Note that the "Deploy to Github Pages" step won't run in this mode,
16
+ # so this won't have any side-effects. But it will tell you if a PR
17
+ # completely broke oranda/mdbook. Sadly we don't provide previews (yet)!
18
+ pull_request :
19
+
20
+ # Whenever something gets pushed to main, update the docs!
21
+ # This is great for getting docs changes live without cutting a full release.
22
+ #
23
+ # Note that if you're using cargo-dist, this will "race" the Release workflow
24
+ # that actually builds the Github Release that oranda tries to read (and
25
+ # this will almost certainly complete first). As a result you will publish
26
+ # docs for the latest commit but the oranda landing page won't know about
27
+ # the latest release. The workflow_run trigger below will properly wait for
28
+ # cargo-dist, and so this half-published state will only last for ~10 minutes.
29
+ #
30
+ # If you only want docs to update with releases, disable this one.
31
+ push :
32
+ branches :
33
+ - main
34
+
35
+ # Whenever a workflow called "Release" completes, update the docs!
36
+ #
37
+ # If you're using cargo-dist, this is recommended, as it will ensure that
38
+ # oranda always sees the latest release right when it's available. Note
39
+ # however that Github's UI is wonky when you use workflow_run, and won't
40
+ # show this workflow as part of any commit. You have to go to the "actions"
41
+ # tab for your repo to see this one running (the gh-pages deploy will also
42
+ # only show up there).
43
+ workflow_run :
44
+ workflows : ["Release"]
45
+ types :
46
+ - completed
47
+
48
+ # Alright, let's do it!
49
+ jobs :
50
+ web :
51
+ name : Build and deploy site and docs
52
+ runs-on : ubuntu-latest
53
+ steps :
54
+ # Setup
55
+ - uses : actions/checkout@v3
56
+ with :
57
+ fetch-depth : 0
58
+ - uses : dtolnay/rust-toolchain@stable
59
+ - uses : swatinem/rust-cache@v2
60
+
61
+ # Install and run oranda (and mdbook)
62
+ # This will write all output to ./public/ (including copying mdbook's output to there)
63
+ - name : Install and run oranda
64
+ run : |
65
+ curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/oranda/releases/download/v0.1.0-prerelease.4/oranda-installer.sh | sh
66
+ oranda build
67
+
68
+ # Deploy to our gh-pages branch (making it if it doesn't exist)
69
+ # the "public" dir that oranda made above will become the root dir
70
+ # of this branch.
71
+ #
72
+ # Note that once the gh-pages branch exists, you must
73
+ # go into repo's settings > pages and set "deploy from branch: gh-pages"
74
+ # the other defaults work fine.
75
+ - name : Deploy to Github Pages
76
+ uses : JamesIves/github-pages-deploy-action@v4.4.1
77
+ # ONLY if we're on main (so no PRs or feature branches allowed!)
78
+ if : ${{ github.ref == 'refs/heads/main' }}
79
+ with :
80
+ branch : gh-pages
81
+ # Gotta tell the action where to find oranda's output
82
+ folder : public
83
+ token : ${{ secrets.GITHUB_TOKEN }}
84
+ single-commit : true
0 commit comments