Skip to content

Commit

Permalink
add ci
Browse files Browse the repository at this point in the history
  • Loading branch information
splitice committed Apr 11, 2024
1 parent 7e51027 commit 8bc9a35
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 3 deletions.
8 changes: 8 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
env:
node: true
es2021: true
extends: 'eslint:recommended'
parserOptions:
ecmaVersion: 12
sourceType: module
rules: {}
69 changes: 69 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Build
on:
push:

jobs:
check_eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install modules
run: |
sudo npm install -g eslint@8
- run: eslint index.js --ext .js,.jsx,.ts,.tsx
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@master
- name: Set up Node.js
uses: actions/setup-node@master
with:
node-version: 17
- run: |
npm install
- run: |
npm run-script test
npm:
name: npm-publish
if: "github.event_name == 'push'"
runs-on: ubuntu-latest
needs: [check_eslint,test]
steps:
- name: Checkout repository
uses: actions/checkout@master
- name: Set up Node.js
uses: actions/setup-node@master
with:
node-version: 16
registry-url: 'https://registry.npmjs.org'
- name: Install modules
run: |
npm install
- name: Test
run: npm test
- run: |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,' | sed -e 's/^v//')
jq '.version="'"$VERSION"'"' package.json > /tmp/a
mv /tmp/a package.json
if: "startsWith(github.ref, 'refs/tags/v')"
- run: |
# npm login --scope=@halleyassist --registry=https://registry.npmjs.org/
npm whoami
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
- run: |
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
if: "startsWith(github.ref, 'refs/tags/v')"
- uses: actions/setup-node@v2
with:
node-version: 16
registry-url: https://npm.pkg.github.com/
if: "startsWith(github.ref, 'refs/tags/v')"
- run: |
npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
if: "startsWith(github.ref, 'refs/tags/v')"
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "rule-parser",
"version": "1.0.0",
"name": "@halleyassist/rule-parser",
"version": "0.1.0",
"description": "The grammar for HalleyAssist rules",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "mocha"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit 8bc9a35

Please sign in to comment.