Skip to content

Commit

Permalink
add action
Browse files Browse the repository at this point in the history
  • Loading branch information
scrypt committed Oct 9, 2023
1 parent 0d2d622 commit ee22e63
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Test
on:
push:
branches:
- master

jobs:
build:
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Prepare git
run: git config --global core.autocrlf false
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- name: Npm Install
run: npm i
- name: gen Env
run: echo "PRIVATE_KEY="${{ secrets.PRIVATE_KEY }}"" > ./test/.env
- name: Test
run: npm t
30 changes: 30 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Publish Package to npmjs
on:
push:
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Prepare git
run: git config --global core.autocrlf false
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v3
with:
node-version: "16.x"
registry-url: "https://registry.npmjs.org"
- run: npm ci
- name: gen Env
run: echo "PRIVATE_KEY="${{ secrets.PRIVATE_KEY }}"" > ./test/.env
- name: Test
run: npm t
- name: Verify Versions
run: node -e "if ('refs/tags/v' + require('./package.json').version !== '${{ github.ref }}') { console.log('::error' + 'Version Mismatch. refs/tags/v' + require('./package.json').version, '${{ github.ref }}'); throw Error('Version Mismatch')} "
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_SCRYPT_ORD }}

0 comments on commit ee22e63

Please sign in to comment.