forked from raycast/extensions
-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (58 loc) · 2.1 KB
/
generate-docs.yml
File metadata and controls
66 lines (58 loc) · 2.1 KB
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
58
59
60
61
62
63
64
65
66
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
sparse-checkout: |
docs/
scripts/
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20.15.1
- 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: Set SHORT_SHA
if: always()
run: echo "SHORT_SHA=${GITHUB_SHA::8}" >> $GITHUB_ENV
- 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: ${{ github.workflow }} has failed
<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Action logs> | <${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}|Commit: ${{ env.SHORT_SHA }}>