Create v2.0.0 #437
Workflow file for this run
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
name: Build | |
on: [push, pull_request] | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
node-version: [12.x] | |
os: [ubuntu-latest] | |
steps: | |
- id: setup-node | |
name: Setup Node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Check out code repository source code | |
uses: actions/checkout@v2 | |
- name: Install dependencies | |
env: | |
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
run: | | |
echo "//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}" > .npmrc | |
yarn | |
# Publishing is done in a separate job to allow | |
# for all matrix builds to complete. | |
release: | |
needs: test | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/master' | |
strategy: | |
fail-fast: false | |
matrix: | |
node: [12] | |
steps: | |
- name: Setup Node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 12.x | |
- name: Check out repo | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 2 | |
# Fetch tags and describe the commit before the merge commit | |
# to see if it's a version publish | |
- name: Fetch tags | |
run: | | |
git fetch --tags | |
if git describe --exact-match --match "v*.*.*" HEAD^2 | |
then | |
echo "Found version commit tag. Publishing." | |
echo "publish=true" >> $GITHUB_ENV | |
else | |
echo "Version commit tag not found. Not publishing." | |
fi | |
- name: Install dependencies | |
env: | |
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
run: | | |
echo "//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}" > .npmrc | |
yarn | |
- name: Publish | |
if: env.publish == 'true' | |
env: | |
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
run: | | |
echo "//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}" > .npmrc | |
npm publish --access public |