mirror of
https://github.com/gosticks/web.git
synced 2026-04-16 10:04:26 +00:00
This allows us to only build once and deploy faster. Signed-off-by: XhmikosR <xhmikosr@gmail.com>
86 lines
2.0 KiB
YAML
86 lines
2.0 KiB
YAML
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 }}"
|
|
|
|
- run: node --version
|
|
- run: npm --version
|
|
|
|
- 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: |
|
|
rm public/fakeAPI/.gitignore # Make sure that the fakeAPI data is deployed
|
|
npm run build-fake
|
|
|
|
- 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/
|