7
7
- develop
8
8
# For documentation specific to a release
9
9
- ' release-v*'
10
+ # stable docs
11
+ - master
10
12
11
13
workflow_dispatch :
12
14
@@ -23,42 +25,42 @@ jobs:
23
25
mdbook-version : ' 0.4.9'
24
26
25
27
- name : Build the documentation
26
- run : mdbook build
27
-
28
- # Deploy to the latest documentation directories
29
- - name : Deploy latest documentation
30
- uses : peaceiris/actions-gh-pages@068dc23d9710f1ba62e86896f84735d869951305 # v3.8.0
31
- with :
32
- github_token : ${{ secrets.GITHUB_TOKEN }}
33
- keep_files : true
34
- publish_dir : ./book
35
- destination_dir : ./develop
28
+ # mdbook will only create an index.html if we're including docs/README.md in SUMMARY.md.
29
+ # However, we're using docs/README.md for other purposes and need to pick a new page
30
+ # as the default. Let's opt for the welcome page instead.
31
+ run : |
32
+ mdbook build
33
+ cp book/welcome_and_overview.html book/index.html
36
34
37
- - name : Get the current Synapse version
35
+ # Figure out the target directory.
36
+ #
37
+ # The target directory depends on the name of the branch
38
+ #
39
+ - name : Get the target directory name
38
40
id : vars
39
- # The $GITHUB_REF value for a branch looks like `refs/heads/release-v1.2`. We do some
40
- # shell magic to remove the "refs/heads/release-v" bit from this, to end up with "1.2",
41
- # our major/minor version number, and set this to a var called `branch-version`.
42
- #
43
- # We then use some python to get Synapse's full version string, which may look
44
- # like "1.2.3rc4". We set this to a var called `synapse-version`. We use this
45
- # to determine if this release is still an RC, and if so block deployment.
46
41
run : |
47
- echo ::set-output name=branch-version::${GITHUB_REF# refs/heads/release-v}
48
- echo ::set-output name=synapse-version::`python3 -c 'import synapse; print(synapse.__version__)'`
42
+ # first strip the ' refs/heads/' prefix with some shell foo
43
+ branch="${GITHUB_REF#refs/heads/}"
49
44
50
- # Deploy to the version-specific directory
51
- - name : Deploy release-specific documentation
52
- # We only carry out this step if we're running on a release branch,
53
- # and the current Synapse version does not have "rc" in the name.
54
- #
55
- # The result is that only full releases are deployed, but can be
56
- # updated if the release branch gets retroactive fixes.
57
- if : ${{ startsWith( github.ref, 'refs/heads/release-v' ) && !contains( steps.vars.outputs.synapse-version, 'rc') }}
58
- uses : peaceiris/actions-gh-pages@v3
45
+ case $branch in
46
+ release-*)
47
+ # strip 'release-' from the name for release branches.
48
+ branch="${branch#release-}"
49
+ ;;
50
+ master)
51
+ # deploy to "latest" for the master branch.
52
+ branch="latest"
53
+ ;;
54
+ esac
55
+
56
+ # finally, set the 'branch-version' var.
57
+ echo "::set-output name=branch-version::$branch"
58
+
59
+ # Deploy to the target directory.
60
+ - name : Deploy to gh pages
61
+ uses : peaceiris/actions-gh-pages@068dc23d9710f1ba62e86896f84735d869951305 # v3.8.0
59
62
with :
60
63
github_token : ${{ secrets.GITHUB_TOKEN }}
61
64
keep_files : true
62
65
publish_dir : ./book
63
- # The resulting documentation will end up in a directory named `vX.Y`.
64
- destination_dir : ./v${{ steps.vars.outputs.branch-version }}
66
+ destination_dir : ./${{ steps.vars.outputs.branch-version }}
0 commit comments