xref: /expo/.github/workflows/docs.yml (revision c255aee5)
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 test
39      - run: yarn danger ci
40        env:
41          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42      - uses: actions/cache@v2
43        with:
44          path: .next
45          key: docs-next-${{ hashFiles('yarn.lock') }}-${{ hashFiles('pages/**') }}
46          restore-keys: |
47            docs-next-${{ hashFiles('yarn.lock') }}-
48            docs-next-
49      - run: yarn export
50        timeout-minutes: 15
51      - name: test links
52        run: |
53          yarn export-server &
54          while ! nc -z localhost 8000; do
55            sleep 1
56          done
57          yarn test-links http://127.0.0.1:8000
58        timeout-minutes: 1
59      - run: sudo apt-get install awscli
60      - run: ./deploy.sh
61        if: ${{ github.event.ref == 'refs/heads/master' }}
62        env:
63          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
64          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
65      - uses: 8398a7/action-slack@v3
66        if: failure() && github.event.ref == 'refs/heads/master'
67        env:
68          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69          SLACK_WEBHOOK_URL: ${{ secrets.slack_webhook_docs }}
70        with:
71          channel: '#docs'
72          status: ${{ job.status }}
73          fields: author,job,message
74          author_name: docs build
75