xref: /expo/.github/workflows/docs.yml (revision 8f105861)
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      - name: test links
59        run: |
60          yarn export-server &
61          while ! nc -z localhost 8000; do
62            sleep 1
63          done
64          yarn test-links http://127.0.0.1:8000
65        timeout-minutes: 1
66      - run: ./deploy.sh
67        if: ${{ github.event.ref == 'refs/heads/master' }}
68        env:
69          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
70          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
71      - uses: 8398a7/action-slack@v3
72        if: failure() && github.event.ref == 'refs/heads/master'
73        env:
74          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75          SLACK_WEBHOOK_URL: ${{ secrets.slack_webhook_docs }}
76        with:
77          channel: '#docs'
78          status: ${{ job.status }}
79          fields: author,job,message
80          author_name: docs build
81