From c4df1cb8a1ad6e4222fbc099f8179cd62fc22c62 Mon Sep 17 00:00:00 2001 From: Tony Samperi Date: Sun, 14 Jul 2024 22:36:32 +0200 Subject: [PATCH] MAINTENANCE * Added automated release --- .../workflows/npm-publish-github-packages.yml | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/npm-publish-github-packages.yml diff --git a/.github/workflows/npm-publish-github-packages.yml b/.github/workflows/npm-publish-github-packages.yml new file mode 100644 index 0000000..fe0922b --- /dev/null +++ b/.github/workflows/npm-publish-github-packages.yml @@ -0,0 +1,30 @@ +# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created +# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages + +name: Publish on NPM + +on: + release: + types: [ created ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 20.11.1 + registry-url: https://registry.npmjs.org/ + - run: corepack enable + - run: yarn install + - run: npm run build + - run: | + pkgversion=$(node -p -e "require('./package.json').version") + if [[ $pkgversion == *"beta"* || $pkgversion =~ -rc\.[0-9]+$ ]]; then + npm run release:beta + else + npm run release + fi + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}