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