1
1
name : Publish
2
2
3
+
3
4
on :
4
5
push :
5
- branches : [ main ]
6
+ branches :
7
+ - main
8
+
9
+ # Allows you to run this workflow manually from the Actions tab
10
+ workflow_dispatch :
6
11
12
+ # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
7
13
permissions :
8
- contents : write
14
+ contents : read
15
+ pages : write
16
+ id-token : write
9
17
10
18
jobs :
11
- build :
19
+ build-and-upload :
12
20
runs-on : ubuntu-latest
13
21
steps :
14
22
# Check out the content (source branch)
15
23
- name : Check out source
16
24
uses : actions/checkout@v3
17
-
18
- # Check out the `dist` branch into the `public` directory.
19
- - name : Check out documentation branch
20
- uses : actions/checkout@v3
21
- with :
22
- ref : ' dist'
23
- path : ' public'
24
-
25
+ - name : Setup Pages
26
+ uses : actions/configure-pages@v1
25
27
- name : Use Node.js
26
28
uses : actions/setup-node@v3
27
29
with :
@@ -35,27 +37,18 @@ jobs:
35
37
env :
36
38
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
37
39
38
- # Check for changes; this avoids publishing a new change to the
39
- # dist branch when we made a change to (for example) a unit test.
40
- # If there were changes made in the publish step above, then this
41
- # will set the variable `has_changes` to `1` for subsequent steps.
42
- - name : Check for changes
43
- id : status
44
- run : |
45
- if [ -n "$(git status --porcelain)" ]; then
46
- echo "::set-output name=has_changes::1"
47
- fi
48
- working-directory : public
49
-
50
- # Commit the changes to the dist branch and push the changes up to
51
- # GitHub. (Replace the name and email address with your own.)
52
- # This step only runs if the previous step set `has_changes` to `1`.
53
- - name : Publish documentation
54
- run : |
55
- git add --verbose .
56
- git config user.name 'npm CLI robot'
57
- git config user.email 'npm-cli+bot@github.com'
58
- git commit -m 'Update from CI'
59
- git push origin dist
60
- if : steps.status.outputs.has_changes == '1'
61
- working-directory : public
40
+ - name : Upload artifact
41
+ uses : actions/upload-pages-artifact@v1
42
+ with :
43
+ path : ' ./public'
44
+
45
+ deploy :
46
+ environment :
47
+ name : github-pages
48
+ url : ${{ steps.deployment.outputs.page_url }}
49
+ runs-on : ubuntu-latest
50
+ needs : build-and-upload
51
+ steps :
52
+ - name : Deploy to GitHub Pages
53
+ id : deployment
54
+ uses : actions/deploy-pages@v1
0 commit comments