77 - develop
88 # For documentation specific to a release
99 - ' release-v*'
10+ # stable docs
11+ - master
1012
1113 workflow_dispatch :
1214
@@ -30,40 +32,35 @@ jobs:
3032 mdbook build
3133 cp book/welcome_and_overview.html book/index.html
3234
33- # Deploy to the latest documentation directories
34- - name : Deploy latest documentation
35- uses : peaceiris/actions-gh-pages@068dc23d9710f1ba62e86896f84735d869951305 # v3.8.0
36- with :
37- github_token : ${{ secrets.GITHUB_TOKEN }}
38- keep_files : true
39- publish_dir : ./book
40- destination_dir : ./develop
41-
42- - 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
4340 id : vars
44- # The $GITHUB_REF value for a branch looks like `refs/heads/release-v1.2`. We do some
45- # shell magic to remove the "refs/heads/release-v" bit from this, to end up with "1.2",
46- # our major/minor version number, and set this to a var called `branch-version`.
47- #
48- # We then use some python to get Synapse's full version string, which may look
49- # like "1.2.3rc4". We set this to a var called `synapse-version`. We use this
50- # to determine if this release is still an RC, and if so block deployment.
5141 run : |
52- echo ::set-output name=branch-version::${GITHUB_REF# refs/heads/release-v}
53- 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/}"
5444
55- # Deploy to the version-specific directory
56- - name : Deploy release-specific documentation
57- # We only carry out this step if we're running on a release branch,
58- # and the current Synapse version does not have "rc" in the name.
59- #
60- # The result is that only full releases are deployed, but can be
61- # updated if the release branch gets retroactive fixes.
62- if : ${{ startsWith( github.ref, 'refs/heads/release-v' ) && !contains( steps.vars.outputs.synapse-version, 'rc') }}
63- 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
6462 with :
6563 github_token : ${{ secrets.GITHUB_TOKEN }}
6664 keep_files : true
6765 publish_dir : ./book
68- # The resulting documentation will end up in a directory named `vX.Y`.
69- destination_dir : ./v${{ steps.vars.outputs.branch-version }}
66+ destination_dir : ./${{ steps.vars.outputs.branch-version }}
0 commit comments