2
2
#
3
3
# This workflow builds the documentation on Linux/macOS/Windows.
4
4
#
5
- # It is run on every commit to the main and pull request branches, and also
6
- # when a new release is published.
7
- # In draft pull requests, only the job on Linux is triggered to save on
8
- # Continuous Integration resources.
5
+ # It is run on every commit to the main and pull request branches, and also when a new
6
+ # release is published. In draft pull requests, only the job on Linux is triggered to
7
+ # save on Continuous Integration resources.
9
8
#
10
9
# On the main branch, the workflow also handles the documentation deployment:
11
10
#
12
- # * Updating the development documentation by pushing the built HTML pages
13
- # from the main branch onto the dev folder of the gh-pages branch.
11
+ # * Updating the development documentation by pushing the built HTML pages from the main
12
+ # branch onto the dev folder of the gh-pages branch.
14
13
# * Updating the latest documentation link to the new release.
15
14
#
16
15
name : Docs
@@ -43,6 +42,9 @@ concurrency:
43
42
group : ${{ github.workflow }}-${{ github.ref }}
44
43
cancel-in-progress : ${{ github.ref != 'refs/heads/main' }}
45
44
45
+ permissions :
46
+ contents : write
47
+
46
48
jobs :
47
49
docs :
48
50
name : ${{ matrix.os }}
73
75
with :
74
76
# fetch all history so that setuptools-scm works
75
77
fetch-depth : 0
78
+ persist-credentials : false
76
79
77
80
- name : Get current week number of year
78
81
id : date
@@ -159,10 +162,11 @@ jobs:
159
162
if : github.event_name == 'push' && matrix.os == 'ubuntu-latest'
160
163
161
164
- name : Upload the HTML ZIP archive and PDF as release assets
162
- run : gh release upload ${{ github.ref_name } } doc/_build/pygmt-docs.zip doc/_build/pygmt-docs.pdf
165
+ run : gh release upload ${REF_NAME } doc/_build/pygmt-docs.zip doc/_build/pygmt-docs.pdf
163
166
if : github.event_name == 'release' && matrix.os == 'ubuntu-latest'
164
167
env :
165
168
GH_TOKEN : ${{ github.token }}
169
+ REF_NAME : ${{ github.ref_name }}
166
170
167
171
- name : Checkout the gh-pages branch
168
172
@@ -172,6 +176,7 @@ jobs:
172
176
path : deploy
173
177
# Download the entire history
174
178
fetch-depth : 0
179
+ persist-credentials : true
175
180
if : (github.event_name == 'release' || github.event_name == 'push') && (matrix.os == 'ubuntu-latest')
176
181
177
182
- name : Push the built HTML to gh-pages
0 commit comments