xref: /expo/.github/workflows/docs.yml (revision 9155fd2f)
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@v1
32        with:
33          path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
34          key: ${{ runner.os }}-yarn-${{ hashFiles('docs/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      - run: yarn export
42        timeout-minutes: 15
43      - name: test links
44        run: |
45          yarn export-server &
46          while ! nc -z localhost 8000; do
47            sleep 1
48          done
49          yarn test-links http://127.0.0.1:8000
50        timeout-minutes: 1
51      - run: sudo apt-get install awscli
52      - run: ./deploy.sh
53        if: ${{ github.event.ref == 'refs/heads/master' }}
54        env:
55          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
56          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
57      - uses: 8398a7/action-slack@v3
58        if: failure() && github.event.ref == 'refs/heads/master'
59        env:
60          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61          SLACK_WEBHOOK_URL: ${{ secrets.slack_webhook_docs }}
62        with:
63          channel: '#docs'
64          status: ${{ job.status }}
65          fields: commit,author,action,message
66          author_name: docs build
67