5
5
branches : [main]
6
6
paths :
7
7
- docs/**
8
+ - ' **/*.yml'
8
9
push :
9
10
branches : [main]
10
11
paths :
@@ -37,10 +38,26 @@ jobs:
37
38
- name : Test build website
38
39
run : yarn build
39
40
41
+ deploy-precheck :
42
+ runs-on : ubuntu-latest
43
+ if : ${{ github.event_name != 'pull_request' }}
44
+ outputs :
45
+ gh-deploy-key : ${{ steps.gh-deploy-key.outputs.defined }}
46
+ steps :
47
+ - id : gh-deploy-key
48
+ env :
49
+ GH_PAGES_DEPLOY : ${{ secrets.GH_PAGES_DEPLOY }}
50
+ if : " ${{ env.GH_PAGES_DEPLOY != '' }}"
51
+ run : echo "::set-output name=defined::true"
52
+
40
53
deploy :
41
- if : ${{ github.event_name != 'pull_request' && github.secrets.GH_PAGES_DEPLOY != '' }}
54
+ needs : [deploy-precheck]
55
+ if : ${{ needs.deploy-precheck.outputs.gh-deploy-key == 'true' }}
42
56
runs-on : ubuntu-latest
43
57
steps :
58
+ - name : Check secret set
59
+ run : |
60
+ echo "GH_PAGES_DEPLOY: ${{ secrets.GH_PAGES_DEPLOY }}"
44
61
- uses : actions/checkout@v4
45
62
with :
46
63
fetch-depth : 0
@@ -56,13 +73,13 @@ jobs:
56
73
cache : yarn
57
74
- uses : webfactory/ssh-agent@v0.5.0
58
75
with :
59
- ssh-private-key : ${{ github.secrets .GH_PAGES_DEPLOY }}
76
+ ssh-private-key : ${{ env .GH_PAGES_DEPLOY }}
60
77
- name : Deploy to GitHub Pages
61
78
env :
62
79
USE_SSH : true
63
80
run : |
64
- export COCOINDEX_DOCS_POSTHOG_API_KEY=${{ github. secrets.COCOINDEX_DOCS_POSTHOG_API_KEY }}
65
- export COCOINDEX_DOCS_MIXPANEL_API_KEY=${{ github. secrets.COCOINDEX_DOCS_MIXPANEL_API_KEY }}
81
+ export COCOINDEX_DOCS_POSTHOG_API_KEY=${{ secrets.COCOINDEX_DOCS_POSTHOG_API_KEY }}
82
+ export COCOINDEX_DOCS_MIXPANEL_API_KEY=${{ secrets.COCOINDEX_DOCS_MIXPANEL_API_KEY }}
66
83
git config --global user.email "cocoindex.io@gmail.com"
67
84
git config --global user.name "CocoIndex"
68
85
yarn install --frozen-lockfile
0 commit comments