name: CI on: [push, pull_request] env: CI: true NODE: 12.x jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Set Node.js version uses: actions/setup-node@v1 with: node-version: "${{ env.NODE }}" - name: Set up npm cache uses: actions/cache@v1 with: path: ~/.npm key: ${{ runner.os }}-node-v${{ env.NODE }}-${{ hashFiles('package.json') }}-${{ hashFiles('package-lock.json') }} restore-keys: | ${{ runner.OS }}-node-v${{ env.NODE }}-${{ hashFiles('package.json') }}-${{ hashFiles('package-lock.json') }} ${{ runner.OS }}-node-v${{ env.NODE }}- - name: Install npm dependencies run: npm ci - name: Check Formatting run: npm run check-format - name: Lint run: npm run lint - name: Test run: npm run coverage - name: Build env: PUBLIC_URL: / run: npm run production - uses: codecov/codecov-action@v1 with: token: ${{ secrets.CODECOV_TOKEN }} fail_ci_if_error: true - name: Upload built files uses: actions/upload-artifact@v1 if: success() && github.ref == 'refs/heads/master' with: name: build path: ./build/ deploy: runs-on: ubuntu-latest needs: [build] if: github.ref == 'refs/heads/master' steps: - uses: actions/checkout@v2 - name: Download built files uses: actions/download-artifact@v1 with: name: build path: ./build/ - name: Deploy uses: peaceiris/actions-gh-pages@v3 if: success() with: cname: web.pi-hole.net emptyCommits: false personal_token: ${{ secrets.PERSONAL_TOKEN }} publish_branch: gh-pages publish_dir: ./build/