name: Test and Release on: workflow_dispatch: push: branches: [main] paths-ignore: - "**.md" - "**/release.yml" - "static/**" - "docs/**" pull_request: branches: [main] permissions: id-token: write contents: write packages: write jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: '20' cache: 'npm' - run: npm ci - run: npm run build - run: npm test release: needs: test runs-on: ubuntu-latest if: github.event_name == 'push' && github.ref == 'refs/heads/main' steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Calculate version id: version uses: lukaszraczylo/shared-actions/.github/actions/semver@main with: config-file: semver.yaml - name: Create tag if: steps.version.outputs.version_tag != '' run: | git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" git tag ${{ steps.version.outputs.version_tag }} git push origin ${{ steps.version.outputs.version_tag }} - uses: actions/setup-node@v4 if: steps.version.outputs.version_tag != '' with: node-version: '24' registry-url: 'https://registry.npmjs.org' - name: Install dependencies run: npm ci - name: Update package version if: steps.version.outputs.version_tag != '' run: npm version ${{ steps.version.outputs.version }} --no-git-tag-version - name: Publish to npm if: steps.version.outputs.version_tag != '' run: npm publish --access public env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}