xref: /expo/.github/workflows/docs.yml (revision e331da1d)
1name: docs
2
3defaults:
4  run:
5    shell: bash
6    working-directory: docs
7
8on:
9  push:
10    branches: [ master ]
11    paths:
12      - 'docs/**'
13      - '.github/workflows/docs.yml'
14  pull_request:
15    branches: [ master ]
16    paths:
17      - 'docs/**'
18      - '.github/workflows/docs.yml'
19
20jobs:
21  docs:
22    runs-on: ubuntu-18.04
23    steps:
24      - name: Check out repository
25        uses: actions/checkout@v2
26        with:
27          submodules: true
28      - name: Get yarn cache directory path
29        id: yarn-cache-dir-path
30        run: echo "::set-output name=dir::$(yarn cache dir)"
31      - uses: actions/cache@v2
32        with:
33          path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
34          key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
35          restore-keys: |
36            ${{ runner.os }}-yarn-
37      - run: yarn install --frozen-lockfile
38      - run: yarn danger ci
39        env:
40          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41      - uses: actions/cache@v2
42        with:
43          path: .next
44          key: docs-next-${{ hashFiles('yarn.lock') }}-${{ hashFiles('pages/**') }}
45          restore-keys: |
46            docs-next-${{ hashFiles('yarn.lock') }}-
47            docs-next-
48      - run: yarn export
49        timeout-minutes: 15
50      - name: test links
51        run: |
52          yarn export-server &
53          while ! nc -z localhost 8000; do
54            sleep 1
55          done
56          yarn test-links http://127.0.0.1:8000
57        timeout-minutes: 1
58      - run: sudo apt-get install awscli
59      - run: ./deploy.sh
60        if: ${{ github.event.ref == 'refs/heads/master' }}
61        env:
62          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
63          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
64      - uses: 8398a7/action-slack@v3
65        if: failure() && github.event.ref == 'refs/heads/master'
66        env:
67          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68          SLACK_WEBHOOK_URL: ${{ secrets.slack_webhook_docs }}
69        with:
70          channel: '#docs'
71          status: ${{ job.status }}
72          fields: commit,author,action,message
73          author_name: docs build
74