xref: /expo/.github/workflows/docs.yml (revision e7a5287c)
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') }}-next-${{ hashFiles('docs/next.config.js') }}
60      - run: yarn export
61        timeout-minutes: 20
62        env:
63          USE_ESBUILD: 1
64      - name: lint links
65        run: yarn lint-links --quiet
66      - name: test links (legacy)
67        run: |
68          yarn export-server &
69          while ! nc -z localhost 8000; do
70            sleep 1
71          done
72          yarn test-links http://127.0.0.1:8000
73        timeout-minutes: 1
74      - run: ./deploy.sh
75        if: ${{ github.event.ref == 'refs/heads/master' }}
76        env:
77          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
78          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
79      - name: �� Notify on Slack
80        uses: 8398a7/action-slack@v3
81        if: failure() && github.event.ref == 'refs/heads/master'
82        env:
83          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
84          SLACK_WEBHOOK_URL: ${{ secrets.slack_webhook_docs }}
85        with:
86          channel: '#docs'
87          status: ${{ job.status }}
88          fields: job,message,ref,eventName,author,took
89          author_name: Docs
90