-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
31f574a
commit 4b235e9
Showing
1 changed file
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: build | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
ci: | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
#hardcode the coveralls token...it's not overly important to protect, and github actions won't allow forks to work with coveralls otherwise | ||
COVERALLS_REPO_TOKEN: "cAEPfB2XY4L96cxO0SFaZeKdxwRCSNjZV" | ||
strategy: | ||
matrix: | ||
os: [ubuntu-18.04, macos-10.15, windows-2019] | ||
steps: | ||
- uses: actions/checkout@master | ||
- uses: actions/setup-node@master | ||
with: | ||
node-version: "10.19.0" | ||
- run: npm ci | ||
- run: npm run build | ||
- run: npm run lint | ||
- run: npm run test | ||
- run: npm run publish-coverage | ||
npm-release: | ||
#only run this task if a tag starting with 'v' was used to trigger this (i.e. a tagged release) | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
needs: ci | ||
runs-on: ubuntu-18.04 | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
steps: | ||
- uses: actions/checkout@master | ||
- uses: actions/setup-node@master | ||
with: | ||
node-version: "10.19.0" | ||
- run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ./.npmrc | ||
- run: npm ci | ||
- run: npm run build | ||
#create npm package | ||
- run: npm pack | ||
|
||
#create GitHub release | ||
- name: Create GitHub Release | ||
id: create_release | ||
uses: actions/create-release@latest | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: ${{ github.ref }} | ||
draft: false | ||
prerelease: false #contains(github.ref, '-beta.') == true | ||
|
||
#upload package to GitHub release | ||
- name: Upload GitHub Release Assets | ||
uses: alexellis/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
asset_paths: '["./*.tgz"]' | ||
|
||
#upload to npm | ||
- run: npm publish |