diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..64d646e --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,46 @@ +name: Release Plugin + +on: + push: + branches: + - main + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '22.x' + registry-url: 'https://registry.npmjs.org' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Run tests + run: npm test + + - name: Build package + run: npm run prepack + + - name: Publish to npm + id: publish + uses: JS-DevTools/npm-publish@v3 + with: + token: ${{ secrets.NPM_TOKEN }} + access: public + + - name: Create GitHub Release + if: steps.publish.outputs.type != 'none' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + VERSION: ${{ steps.publish.outputs.version }} + run: | + gh release create v"$VERSION" \ + --title "Release $VERSION" \ + --generate-notes \ No newline at end of file