forked from raycast/extensions
-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (50 loc) · 1.91 KB
/
generate-docs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: Generate Docs
on:
push:
paths:
- "docs/**"
branches: ["main"]
workflow_dispatch:
workflow_call:
jobs:
generate-docs:
if: github.repository == 'raycast/extensions'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Setup Node.js
uses: raycast/github-actions/setup-node@master
- name: Setup git
uses: raycast/github-actions/setup-git@master
- name: Fetch the latest types
run: |
configJson=`cat ./docs/.config.json`
version=`echo $(jq -r '.version' <<< "$configJson")`
http_response=$(curl -s -o types.d.ts -w "%{http_code}" "https://unpkg.com/@raycast/api@$version/types/index.d.ts")
if [ $http_response != "200" ]; then
echo "Couldn't fetch the types"
exit 1
fi
- name: Generate the docs
run: |
rsync -arv ./docs/ ./generated-docs
node ./scripts/stitch-docs.js
npm_config_yes=true npx @raycast/generate-docs --docs=./generated-docs --types=./types.d.ts --output=./generated-docs
rm types.d.ts
- name: Deploy the generated docs to the gh-pages branch
uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{ secrets.RAYCAST_BOT_API_ACCESS_TOKEN }}
publish_dir: ./generated-docs
- name: Notify Failure to Slack
if: failure()
uses: raycast/github-actions/slack-send@master
with:
webhook: ${{ secrets.SLACK_RELEASE_CHANNEL_WEBHOOK_URL }}
color: "danger"
text: |
:no_entry_sign: ${env.GITHUB_WORKFLOW} has failed
<${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}|Action logs> | <${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/commit/${ env.GITHUB_SHA }|Commit: ${ env.GITHUB_SHA.substr(0,8) }>