diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..5ff3666 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,23 @@ +name: publish + +on: + release: + types: + - created + +jobs: + publish: + runs-on: ubuntu-latest + environment: release + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: latest + cache: npm + - run: npm ci + - run: | + npm version ${GITHUB_REF_NAME#v} + npm publish + with: + NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..1202e29 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,25 @@ +name: test + +on: + pull_request: + +jobs: + test: + strategy: + matrix: + node-version: ['16', '18', '20'] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: npm + - run: npm ci + - run: npm run lint + - run: npm test -- --coverage --coverageDirectory=coverage/results-${{ matrix.node-version }} + - uses: actions/upload-artifact@v3 + with: + name: jest-results-${{ matrix.node-version }} + path: coverage/results-${{ matrix.node-version }}/*.xml + if: ${{ always() }}