Docs: update for the new API release #322
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
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: 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) }> |