2019-10-21 18:20:39 +02:00
|
|
|
name: Publish Package
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
|
|
|
with:
|
|
|
|
fetch-depth: 1
|
|
|
|
- uses: actions/setup-node@v1
|
|
|
|
with:
|
|
|
|
node-version: 10
|
|
|
|
# run all tests
|
|
|
|
- run: |
|
2019-10-21 22:43:38 +02:00
|
|
|
npm ci
|
|
|
|
npm run build
|
|
|
|
npx bundlesize
|
|
|
|
npm run coverage
|
|
|
|
npm run test:e2e
|
2019-10-21 18:20:39 +02:00
|
|
|
env:
|
|
|
|
CI: true
|
|
|
|
CI_REPO_NAME: ${{ github.event.repository.name }}
|
|
|
|
CI_REPO_OWNER: ${{ github.event.organization.login }}
|
|
|
|
CI_COMMIT_SHA: ${{ github.sha }}
|
|
|
|
GIT_COMMIT: ${{ github.sha }}
|
|
|
|
CI_BRANCH: ${{ github.head_ref }}
|
2019-10-22 23:20:40 +02:00
|
|
|
BUNDLESIZE_GITHUB_TOKEN: ${{secrets.BUNDLESIZE_GITHUB_TOKEN}}
|
2019-10-21 18:20:39 +02:00
|
|
|
FORCE_COLOR: 2
|
|
|
|
HUSKY_SKIP_INSTALL: true
|
|
|
|
|
|
|
|
- name: Upload coverage to Codecov
|
|
|
|
run: bash <(curl -s https://codecov.io/bash)
|
|
|
|
-f ./coverage/lcov.info
|
|
|
|
-B ${{ github.head_ref }}
|
|
|
|
-C ${{ github.sha }}
|
|
|
|
-Z || echo 'Codecov upload failed'
|
|
|
|
env:
|
|
|
|
CI: true
|
|
|
|
GITLAB_CI: true # pretend we are GitLab CI, while Codecov adding support for Github Actions
|
|
|
|
CODECOV_ENV: github-action
|
|
|
|
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
|
|
|
|
|
|
|
|
publish-npm:
|
|
|
|
needs: build
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
|
|
|
with:
|
|
|
|
fetch-depth: 1
|
|
|
|
- uses: actions/setup-node@v1
|
|
|
|
with:
|
|
|
|
node-version: 10
|
|
|
|
registry-url: https://registry.npmjs.org/
|
|
|
|
- run: npm ci
|
|
|
|
env:
|
|
|
|
CYPRESS_INSTALL_BINARY: 0
|
|
|
|
HUSKY_SKIP_INSTALL: true
|
|
|
|
- run: npm publish
|
|
|
|
env:
|
2019-10-24 18:20:57 +02:00
|
|
|
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
|
|
|
|
|
|
|
deploy-gh-pages:
|
|
|
|
needs: publish-npm
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
|
|
|
with:
|
|
|
|
fetch-depth: 1
|
|
|
|
- uses: actions/setup-node@v1
|
|
|
|
with:
|
|
|
|
node-version: 10
|
|
|
|
registry-url: https://registry.npmjs.org/
|
|
|
|
- name: Build
|
|
|
|
run: |
|
|
|
|
npm ci
|
|
|
|
npm run build
|
|
|
|
rm -rf public/test
|
|
|
|
- name: Deploy
|
|
|
|
uses: peaceiris/actions-gh-pages@v2.5.0
|
|
|
|
env:
|
|
|
|
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
|
|
|
|
PUBLISH_BRANCH: gh-pages
|
|
|
|
PUBLISH_DIR: ./public
|