xref: /expo/.github/workflows/docs.yml (revision d7aff228)
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-20.04
27    steps:
28      - name: �� Checkout
29        uses: actions/checkout@v3
30        with:
31          submodules: true
32      - name: ⬢ Setup Node
33        uses: actions/setup-node@v3
34        with:
35          node-version: 16.x
36      - name: ♻️ Restore caches
37        uses: ./.github/actions/expo-caches
38        id: expo-caches
39        with:
40          yarn-docs: 'true'
41      - name: ➕ Add `bin` to GITHUB_PATH
42        run: echo "$(pwd)/bin" >> $GITHUB_PATH
43      - name: �� Yarn install
44        if: steps.expo-caches.outputs.yarn-docs-hit != 'true'
45        run: yarn install --frozen-lockfile
46      - name: �� Run Docs tests
47        run: yarn test
48      - name: �� Lint Docs app
49        run: yarn lint --max-warnings 0
50      - name: �� Lint Docs content
51        run: yarn lint-case
52      - run: yarn danger ci
53        env:
54          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55      - name: ��️ Build Docs website for deploy
56        run: yarn export
57        timeout-minutes: 20
58      # TODO(cedric): If we have time, we should make sure all links are valid and connected to a proper header
59      # - name: lint links
60      #   run: yarn lint-links --quiet
61      - name: ✅ Test links (legacy)
62        run: |
63          yarn export-server &
64          while ! nc -z localhost 8000; do
65            sleep 1
66          done
67          yarn test-links http://127.0.0.1:8000
68        timeout-minutes: 1
69      - name: �� Deploy Docs website
70        if: ${{ github.event.ref == 'refs/heads/main' }}
71        run: ./deploy.sh
72        env:
73          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
74          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
75          AWS_DEFAULT_REGION: 'us-east-2'
76      - name: �� Notify on Slack
77        uses: 8398a7/action-slack@v3
78        if: failure() && github.event.ref == 'refs/heads/main'
79        env:
80          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81          SLACK_WEBHOOK_URL: ${{ secrets.slack_webhook_docs }}
82        with:
83          channel: '#docs'
84          status: ${{ job.status }}
85          fields: job,message,ref,eventName,author,took
86          author_name: Docs
87