Skip to content

Commit d70df43

Browse files
committed
save
1 parent 13d4dd3 commit d70df43

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

.github/workflows/flow-publish-jsdoc-github-pages.yaml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515
##
1616

17-
name: GitHub pages
17+
name: Publish JsDoc
1818

1919
on:
2020
push:
@@ -25,13 +25,15 @@ on:
2525
jobs:
2626
deploy:
2727
runs-on: ubuntu-latest
28+
env:
29+
PR_PATH: pull/${{github.event.number}}
2830
permissions:
2931
contents: write
3032
concurrency:
3133
group: ${{ github.workflow }}-${{ github.ref }}
3234
steps:
3335
- name: Checkout code
34-
uses: actions/checkout@v2
36+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
3537

3638
- name: Build
3739
uses: andstor/jsdoc-action@v1
@@ -42,9 +44,23 @@ jobs:
4244
template: minami
4345
front_page: README.md
4446

45-
- name: Deploy
47+
- name: Deploy if this is the `main` branch
4648
uses: peaceiris/actions-gh-pages@v3
47-
if: github.ref == 'refs/heads/00119-jsdoc-support'
49+
if: github.ref == 'refs/heads/main'
50+
with:
51+
github_token: ${{ secrets.GITHUB_TOKEN }}
52+
publish_dir: ./public
53+
54+
55+
- name: Set base URL for preview if PR
56+
if: github.ref != 'refs/heads/main'
57+
run: echo "BASE_URL=https://${{ env.DOMAIN }}/${{ github.event.repository.name }}/${{ env.PR_PATH}}/" >> $GITHUB_ENV
58+
59+
- name: Deploy to PR preview
60+
uses: peaceiris/actions-gh-pages@v3
61+
if: github.ref != 'refs/heads/main'
4862
with:
4963
github_token: ${{ secrets.GITHUB_TOKEN }}
5064
publish_dir: ./out
65+
destination_dir: ${{ env.PR_PATH }} # TODO you need to set this if you're using a custom domain. Otherwise you can remove it.
66+

0 commit comments

Comments
 (0)