diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..87a3d73e --- /dev/null +++ b/.github/workflows/release.yml @@ -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}} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..e5563085 --- /dev/null +++ b/.github/workflows/test.yml @@ -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