Skip to content
This repository has been archived by the owner on Jun 28, 2022. It is now read-only.

Commit

Permalink
Add Github Actions CI (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
prescottprue authored Jun 16, 2020
1 parent 59d3800 commit 3d4436b
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 31 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: NPM Package Publish

on:
push:
branches:
- master
- next

jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Use Node 12
uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://registry.npmjs.org/

- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}

- name: Install Dependencies
env:
HUSKY_SKIP_INSTALL: 1 # Skip install of Husky
run: yarn install --frozen-lockfile

# - name: Check Lint
# run: yarn lint

# - name: Run Tests
# run: |
# yarn test

- name: Check version changes
uses: EndBug/version-check@v1
id: check

- name: Version update detected
if: steps.check.outputs.changed == 'true'
run: 'echo "Version change found! New version: ${{ steps.check.outputs.version }} (${{ steps.check.outputs.type }})"'

- name: Publish
if: steps.check.outputs.changed == 'true'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
GITHUB_REF: ${{ github.ref }}
run: |
npm publish $([ "$GITHUB_REF" == 'refs/heads/next' ] && echo '--tag next')
echo "::set-env name=PACKAGE_VERSION::$(cat package.json | jq -r '.version')"
# - name: Upload Code Coverage (Codecov)
# if: steps.check.outputs.changed == 'true' && success()
# env:
# CODE_COV: ${{ secrets.CODE_COV }}
# run: bash <(curl -s https://codecov.io/bash) -f coverage/lcov.info

- name: Create Release
if: github.ref == 'refs/heads/master' && steps.check.outputs.changed == 'true'
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ github.token }}
with:
tag_name: v${{ env.PACKAGE_VERSION }}
release_name: v${{ env.PACKAGE_VERSION }}
draft: false
prerelease: false
31 changes: 0 additions & 31 deletions .travis.yml

This file was deleted.

0 comments on commit 3d4436b

Please sign in to comment.