xref: /expo/.github/workflows/docs.yml (revision dd01cd4e)
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 danger ci
45        env:
46          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47      - name: Cache Next folder
48        uses: actions/cache@v2
49        with:
50          path: docs/.next/cache
51          key: docs-next-${{ hashFiles('docs/yarn.lock') }}
52          restore-keys: |
53            docs-next-${{ hashFiles('docs/yarn.lock') }}-
54            docs-next-
55      - run: yarn export
56        timeout-minutes: 15
57      - name: test links
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      - run: ./deploy.sh
66        if: ${{ github.event.ref == 'refs/heads/master' }}
67        env:
68          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
69          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
70      - uses: 8398a7/action-slack@v3
71        if: failure() && github.event.ref == 'refs/heads/master'
72        env:
73          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74          SLACK_WEBHOOK_URL: ${{ secrets.slack_webhook_docs }}
75        with:
76          channel: '#docs'
77          status: ${{ job.status }}
78          fields: author,job,message
79          author_name: docs build
80