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