xref: /expo/.github/workflows/docs.yml (revision 97ff2dea)
1name: Docs Website
2
3defaults:
4  run:
5    shell: bash
6    working-directory: docs
7
8on:
9  workflow_dispatch: {}
10  push:
11    branches: [main]
12    paths:
13      - 'docs/**'
14      - '.github/workflows/docs.yml'
15  pull_request:
16    paths:
17      - 'docs/**'
18      - '.github/workflows/docs.yml'
19
20concurrency:
21  group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
22  cancel-in-progress: true
23
24jobs:
25  docs:
26    runs-on: ubuntu-22.04
27    steps:
28      - name: �� Checkout
29        uses: actions/checkout@v3
30      - name: ⬢ Setup Node
31        uses: actions/setup-node@v3
32        with:
33          node-version: 16.x
34      - name: ♻️ Restore caches
35        uses: ./.github/actions/expo-caches
36        id: expo-caches
37        with:
38          yarn-docs: 'true'
39      - name: ➕ Add `bin` to GITHUB_PATH
40        run: echo "$(pwd)/bin" >> $GITHUB_PATH
41      - name: �� Yarn install
42        if: steps.expo-caches.outputs.yarn-docs-hit != 'true'
43        run: yarn install --frozen-lockfile
44      - name: �� Run Docs tests
45        run: yarn test
46      - name: �� Lint Docs app
47        run: yarn lint --max-warnings 0
48      - name: �� Lint Docs content
49        run: yarn lint-case
50      - run: yarn danger ci
51        env:
52          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53      - name: ��️ Build Docs website for deploy
54        run: yarn export
55        timeout-minutes: 20
56      # TODO(cedric): If we have time, we should make sure all links are valid and connected to a proper header
57      # - name: lint links
58      #   run: yarn lint-links --quiet
59      - name: ✅ Test links (legacy)
60        run: |
61          yarn export-server &
62          while ! nc -z localhost 8000; do
63            sleep 1
64          done
65          yarn test-links http://127.0.0.1:8000
66        timeout-minutes: 1
67      - name: �� Deploy Docs website
68        if: ${{ github.event.ref == 'refs/heads/main' }}
69        run: ./deploy.sh
70        env:
71          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
72          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
73          AWS_DEFAULT_REGION: 'us-east-2'
74      - name: �� Notify on Slack
75        uses: 8398a7/action-slack@v3
76        if: failure() && github.event.ref == 'refs/heads/main'
77        env:
78          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79          SLACK_WEBHOOK_URL: ${{ secrets.slack_webhook_docs }}
80        with:
81          channel: '#docs'
82          status: ${{ job.status }}
83          fields: job,message,ref,eventName,author,took
84          author_name: Docs
85