xref: /expo/.github/workflows/docs.yml (revision bb8f4f99)
1name: docs
2
3defaults:
4  run:
5    shell: bash
6    working-directory: docs
7
8on:
9  workflow_dispatch: {}
10  push:
11    branches: [master]
12    paths:
13      - 'docs/**'
14      - '.github/workflows/docs.yml'
15  pull_request:
16    branches: [master]
17    paths:
18      - 'docs/**'
19      - '.github/workflows/docs.yml'
20
21jobs:
22  docs:
23    runs-on: ubuntu-18.04
24    steps:
25      - name: Install Node 14
26        uses: actions/setup-node@v1
27        with:
28          node-version: 14.x
29      - name: Check out repository
30        uses: actions/checkout@v2
31        with:
32          submodules: true
33      - name: Get yarn cache directory path
34        id: yarn-cache-dir-path
35        run: echo "::set-output name=dir::$(yarn cache dir)"
36      - uses: actions/cache@v2
37        with:
38          path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
39          key: ${{ runner.os }}-yarn-${{ hashFiles('docs/yarn.lock') }}
40          restore-keys: |
41            ${{ runner.os }}-yarn-
42      - run: yarn install --frozen-lockfile
43      - run: yarn test
44      - run: yarn lint --max-warnings 0
45      - run: yarn danger ci
46        env:
47          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48      - name: Cache Next folder
49        uses: actions/cache@v2
50        with:
51          path: docs/.next/cache
52          key: docs-next-${{ hashFiles('docs/yarn.lock') }}
53          restore-keys: |
54            docs-next-${{ hashFiles('docs/yarn.lock') }}-
55            docs-next-
56      - run: yarn export
57        timeout-minutes: 15
58        env:
59          USE_ESBUILD: 1
60      - name: lint links
61        run: yarn lint-links --quiet
62      - name: test links (legacy)
63        run: |
64          yarn export-server &
65          while ! nc -z localhost 8000; do
66            sleep 1
67          done
68          yarn test-links http://127.0.0.1:8000
69        timeout-minutes: 1
70      - run: ./deploy.sh
71        if: ${{ github.event.ref == 'refs/heads/master' }}
72        env:
73          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
74          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
75      - name: �� Notify on Slack
76        uses: 8398a7/action-slack@v3
77        if: failure() && github.event.ref == 'refs/heads/master'
78        env:
79          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
80          SLACK_WEBHOOK_URL: ${{ secrets.slack_webhook_docs }}
81        with:
82          channel: '#docs'
83          status: ${{ job.status }}
84          fields: job,commit,ref,eventName,author,took
85          author_name: Docs
86