Merge branch 'feature/reg-api' into develop #92
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Package to npmjs | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
pull_request: | |
types: [opened, synchronize, reopened] | |
branches: | |
- main | |
- develop | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
node-version: ['18.x', '20.x', '22.x'] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
- uses: actions/setup-node@v4 | |
name: Use Node.js ${{ matrix.node-version }} | |
with: | |
node-version: ${{ matrix.node-version }} | |
registry-url: 'https://registry.npmjs.org' | |
cache: pnpm | |
- run: pnpm install | |
- run: pnpm build | |
- run: npm link | |
- run: pnpm test:unit --runInBand --coverage | |
- run: pnpm test:integration --runInBand | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
- run: pnpm test:cli --runInBand | |
if: ${{ matrix.os == 'windows-latest' }} | |
# Basic test to make sure generator works | |
- run: npx scffld generate ./src/ | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v4.0.1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
release: | |
runs-on: ubuntu-latest | |
needs: [test] | |
if: ${{ github.event_name == 'push' && endsWith(github.ref, '/main') }} | |
permissions: | |
contents: read | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
registry-url: 'https://registry.npmjs.org' | |
cache: pnpm | |
- name: get-npm-version | |
id: package-version | |
uses: martinbeentjes/npm-get-version-action@v1.3.1 | |
- run: pnpm install | |
- run: pnpm build | |
- run: pnpm publish --provenance --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- run: npx jsr publish |