Skip to content

Commit

Permalink
add gh actions build
Browse files Browse the repository at this point in the history
  • Loading branch information
shuebner committed Oct 20, 2024
1 parent 1fae1a9 commit 5a3bf94
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/commit_gate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Commit Gate

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- name: checkout code
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20' # Or any other version you need

- name: Install dependencies
run: npm ci --prefix src/

- name: Build
run: npm run build --prefix src/

- name: Install test dependencies
run: npm ci --prefix tests/

- name: Run tests
run: npm run test --prefix tests/
36 changes: 36 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Publish npm package

on:
push:
tags: v*

jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read
id-token: write

steps:
- name: checkout code
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'

- name: Create npm package
run: |
cd src
npm version ${{ steps.get_version.outputs.version_number }}
npm pack
- name: Publish package
run: |
cd src
npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 comments on commit 5a3bf94

Please sign in to comment.