.github/workflows/ci.yml
name: main
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
test:
strategy:
matrix:
platform: [ubuntu-latest, macOS-latest]
node: ['16', '14']
name: test/node ${{ matrix.node }}/${{ matrix.platform }}
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@master
- uses: actions/setup-node@master
with:
node-version: ${{ matrix.node }}
- run: npm install -g yarn
- run: yarn install
- run: yarn test
coverage:
needs: [test]
name: coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/setup-node@master
with:
node-version: '14'
- run: npm install -g yarn
- run: yarn install
- uses: paambaati/codeclimate-action@v3.0.0
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
coverageCommand: yarn run coverage
coverageLocations: ${{github.workspace}}/coverage/lcov.info:lcov
debug: true
publish:
if: ${{ github.ref_name == 'master' }}
needs: [coverage]
name: publish
runs-on: ubuntu-latest
steps:
- name: checkout root
uses: actions/checkout@master
- name: use nodejs
uses: actions/setup-node@master
with:
node-version: 14
registry-url: https://registry.npmjs.org/
- name: credentials
run: |
git config user.name "${{ secrets.GH_USERNAME }}"
git config user.email "${{ secrets.GH_EMAIL }}"
- name: install dev dependencies
run: npm install --ignore-scripts
- name: publish application
run: make publish
- name: push to master
run: git push
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}