xref: /expo/.github/workflows/docs.yml (revision 4c360b75)
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: lint links
59        run: yarn lint-links --quiet
60      - name: test links (legacy)
61        run: |
62          yarn export-server &
63          while ! nc -z localhost 8000; do
64            sleep 1
65          done
66          yarn test-links http://127.0.0.1:8000
67        timeout-minutes: 1
68      - run: ./deploy.sh
69        if: ${{ github.event.ref == 'refs/heads/master' }}
70        env:
71          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
72          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
73      - uses: 8398a7/action-slack@v3
74        if: failure() && github.event.ref == 'refs/heads/master'
75        env:
76          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77          SLACK_WEBHOOK_URL: ${{ secrets.slack_webhook_docs }}
78        with:
79          channel: '#docs'
80          status: custom
81          fields: author,commit
82          custom_payload: |
83            {
84              username: 'github-actions',
85              icon_emoji: ':octocat:',
86              attachments: [{
87                color: 'danger',
88                text: `docs build failed: ${process.env.AS_COMMIT} by ${process.env.AS_AUTHOR}`,
89              }]
90            }
91