66 paths :
77 - docs/**
88 - " .github/workflows/docs.yml"
9- push :
10- branches : [main]
11- paths :
12- - docs/**
13- - " .github/workflows/docs.yml"
149 workflow_dispatch :
1510
1611permissions :
1712 contents : write
1813
1914jobs :
2015 test-deploy :
21- if : github.event_name != 'push '
16+ if : github.event_name == 'pull_request '
2217 runs-on : ubuntu-latest
2318 steps :
2419 - uses : actions/checkout@v4
3227 - name : Test build website
3328 run : yarn --cwd docs build
3429
35- deploy-precheck :
36- if : ${{ github.event_name != 'pull_request' }}
37- runs-on : ubuntu-latest
38- environment : docs-release
39- outputs :
40- gh-deploy-key : ${{ steps.gh-deploy-key.outputs.defined }}
41- steps :
42- - id : gh-deploy-key
43- env :
44- GH_PAGES_DEPLOY : ${{ secrets.GH_PAGES_DEPLOY }}
45- if : " ${{ env.GH_PAGES_DEPLOY != '' }}"
46- run : echo "defined=true" >> $GITHUB_OUTPUT
47-
4830 deploy :
49- needs : [deploy-precheck]
50- if : ${{ needs.deploy-precheck.outputs.gh-deploy-key == 'true' }}
51- runs-on : ubuntu-latest
52- environment : docs-release
53- steps :
54- - uses : actions/checkout@v4
55- - uses : actions/setup-node@v4
56- with :
57- node-version : 18
58- cache : yarn
59- cache-dependency-path : docs/yarn.lock
60- -
uses :
webfactory/[email protected] 61- with :
62- ssh-private-key : ${{ secrets.GH_PAGES_DEPLOY }}
63- - name : Deploy to GitHub Pages
64- env :
65- USE_SSH : true
66- run : |
67- export COCOINDEX_DOCS_POSTHOG_API_KEY=${{ vars.COCOINDEX_DOCS_POSTHOG_API_KEY }}
68- export COCOINDEX_DOCS_MIXPANEL_API_KEY=${{ vars.COCOINDEX_DOCS_MIXPANEL_API_KEY }}
69- export COCOINDEX_DOCS_ALGOLIA_APP_ID=${{ vars.COCOINDEX_DOCS_ALGOLIA_APP_ID }}
70- export COCOINDEX_DOCS_ALGOLIA_API_KEY=${{ vars.COCOINDEX_DOCS_ALGOLIA_API_KEY }}
71- git config --global user.email "${{ vars.COCOINDEX_DOCS_DEPLOY_USER_EMAIL }}"
72- git config --global user.name "${{ vars.COCOINDEX_DOCS_DEPLOY_USER_NAME }}"
73- yarn --cwd docs install --frozen-lockfile
74- yarn --cwd docs deploy
31+ name : Release Docs
32+ if : ${{ github.event_name == 'workflow_dispatch' }}
33+ uses : ./.github/workflows/_doc_release.yml
0 commit comments