diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index cfb01b59e..3821a63c2 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -18,9 +18,11 @@ on:
push:
branches:
- main
- pull_request:
+ pull_request_target:
branches:
- main
+ - docs
+ - dev/docs
jobs:
build:
@@ -29,10 +31,29 @@ jobs:
matrix:
os: [ubuntu-20.04]
steps:
+ - uses: actions/setup-node@v3
+ with:
+ node-version: 16
+
- uses: actions/checkout@v2
with:
submodules: true
+ - name: Leave the comment on pull request when started
+ if: ${{ github.event_name == 'pull_request_target' }}
+ uses: actions-cool/maintain-one-comment@v3
+ with:
+ token: ${{ secrets.GITHUB_TOKEN }}
+ body: |
+ ⚡️ Deploying PR Preview ${{ github.event.pull_request.head.sha }} to [surge.sh](https://alibaba-graphar-build-pr-${{ github.event.number }}.surge.sh) ... [Build logs](https://github.com/alibaba/GraphAr/runs/${{ github.run_id }})
+
+
+
+
+
+ 🤖 By [surge-preview](https://surge.sh/)
+ body-include: ''
+
- name: Install dependencies
run: |
sudo apt-get update -y
@@ -47,17 +68,43 @@ jobs:
make doc
popd
- - name: preview
- uses: afc163/surge-preview@v1
- id: preview_step
+ - name: Preview using surge
+ if: ${{ github.event_name == 'pull_request_target' && github.repository == 'alibaba/GraphAr' }}
+ run: |
+ npm install -g surge
+ surge ./docs/_build/html \
+ alibaba-graphar-build-pr-${{ github.event.number }}.surge.sh \
+ --token ${{ secrets.SURGE_TOKEN }}
+
+ - name: Leave the comment on pull request when succeed
+ if: ${{ github.event_name == 'pull_request_target' }}
+ uses: actions-cool/maintain-one-comment@v3
+ with:
+ token: ${{ secrets.GITHUB_TOKEN }}
+ body: |
+ 🎊 PR Preview ${{ github.event.pull_request.head.sha }} has been successfully built and deployed to https://alibaba-graphar-build-pr-${{ github.event.number }}.surge.sh
+
+
+
+
+
+ 🤖 By [surge-preview](https://surge.sh/)
+ body-include: ''
+
+ - name: Leave the comment on pull request when failed
+ if: ${{ failure() && github.event_name == 'pull_request_target' }}
+ uses: actions-cool/maintain-one-comment@v3
with:
- surge_token: ${{ secrets.SURGE_TOKEN }}
- github_token: ${{ secrets.GITHUB_TOKEN }}
- dist: docs/_build/html
- build: echo "done"
+ token: ${{ secrets.GITHUB_TOKEN }}
+ body: |
+ 😭 Deploy PR Preview ${{ github.event.pull_request.head.sha }} failed. [Build logs](https://github.com/alibaba/GraphAr/runs/${{ github.run_id }})
+
+
+
+
- - name: Get the preview_url
- run: echo "url => ${{ steps.preview_step.outputs.preview_url }}"
+ 🤖 By [surge-preview](https://surge.sh/)
+ body-include: ''
- name: Commit Doc
if: ${{ github.ref == 'refs/heads/main' && github.repository == 'alibaba/GraphAr' }}