xref: /expo/.github/workflows/docs.yml (revision 6d147401)
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      - run: yarn danger ci
49        env:
50          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51      - name: ��️ Build Docs website for deploy
52        run: yarn export
53        timeout-minutes: 20
54      # TODO(cedric): If we have time, we should make sure all links are valid and connected to a proper header
55      # - name: lint links
56      #   run: yarn lint-links --quiet
57      - name: ✅ Test links (legacy)
58        run: |
59          yarn export-server &
60          while ! nc -z localhost 8000; do
61            sleep 1
62          done
63          yarn test-links http://127.0.0.1:8000
64        timeout-minutes: 1
65      - name: �� Deploy Docs website
66        if: ${{ github.event.ref == 'refs/heads/main' }}
67        run: ./deploy.sh
68        env:
69          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
70          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
71          AWS_DEFAULT_REGION: 'us-east-2'
72          AWS_BUCKET: 'docs.expo.dev'
73      - name: �� Notify on Slack
74        uses: 8398a7/action-slack@v3
75        if: failure() && github.event.ref == 'refs/heads/main'
76        env:
77          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78          SLACK_WEBHOOK_URL: ${{ secrets.slack_webhook_docs }}
79        with:
80          channel: '#docs'
81          status: ${{ job.status }}
82          fields: job,message,ref,eventName,author,took
83          author_name: Docs
84