Skip to content

Commit

Permalink
GH actions
Browse files Browse the repository at this point in the history
  • Loading branch information
chgeo committed Dec 5, 2023
1 parent 9e3c2f9 commit dfed496
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Release

on:
workflow_dispatch:

permissions:
contents: write

jobs:

publish-npm:
runs-on: ubuntu-latest
environment: npm
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org/

- name: Run Unit Tests
run: |
npm install
npm run test
- name: get-version
id: package-version
uses: martinbeentjes/npm-get-version-action@v1.2.3
- name: Parse changelog
id: parse-changelog
uses: schwma/parse-changelog-action@v1.0.0
with:
version: '${{ steps.package-version.outputs.current-version }}'
- name: Create a GitHub release
uses: ncipollo/release-action@v1
with:
tag: 'v${{ steps.package-version.outputs.current-version }}'
body: '${{ steps.parse-changelog.outputs.body }}'
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
27 changes: 27 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Tests

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

jobs:
test:
strategy:
matrix:
version: [20, 18]
platform: [ macos-latest, ubuntu-latest, windows-latest ]
runs-on: ${{ matrix.platform }}

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.version }}

- name: Run Unit Tests
run: |
npm install
npm run test

0 comments on commit dfed496

Please sign in to comment.