Skip to content
This repository has been archived by the owner on Aug 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #4 from nighca/actions
Browse files Browse the repository at this point in the history
Add github actions
  • Loading branch information
surmon-china authored Jul 13, 2020
2 parents 0b0abbb + 9d0cbbf commit 99e1c29
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 1 deletion.
31 changes: 31 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: CI

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [8.x, 10.x, 12.x]

steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: install deps & check
run: |
yarn
yarn run ci
env:
CI: true
19 changes: 19 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Publish

on:
release:
types: [published]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: Install dependencies
run: yarn
- name: Publish to npm
run: npm publish --access=public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
29 changes: 29 additions & 0 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Tag

on:
push:
branches:
- master

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: Create tag
run: |
tagName="v$(jq '.version' package.json | sed "s/\"//g")"
if [[ -n $(git ls-remote --tags origin $tagName) ]]; then
echo "tag $tagName already exists, skip release"
else
git config --local user.email "actions@github.com"
git config --local user.name "GitHub Actions"
git tag -a $tagName -m "release by Github Actions"
fi
- name: Push to repo
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: master
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"format": "prettier --write '**/*.{js,json,css,md,less,tsx,ts}'",
"check-formatting": "prettier --check '**/*.{js,json,css,md,less,tsx,ts}'",
"codecov": "codecov",
"commit": "commit"
"commit": "commit",
"ci": "yarn check-types && yarn check-formatting && yarn test"
},
"files": [
"dist/lib"
Expand Down

0 comments on commit 99e1c29

Please sign in to comment.