From b2f2f0e563ec1569e8f624126c89077fc73f7913 Mon Sep 17 00:00:00 2001 From: mehdi Date: Tue, 19 Oct 2021 01:23:02 +0200 Subject: [PATCH] publish action --- .github/workflows/publish.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..7da64e7 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,21 @@ +name: Publish Package +on: + release: + types: [created] +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: '14.x' + registry-url: 'https://registry.npmjs.org' + - run: npm ci + - run: npm run prepublishOnly + - id: get_npm_label + run: if (npx semver ${{ github.event.release.tag_name }} --range '>0.0.0'); then echo ::set-output name=NPM_LABEL::latest; else echo ::set-output name=NPM_LABEL::beta; fi; # Using the fact that semver by default considers that pre-releases do not respect stable ranges + - run: npm publish --tag=${NPM_LABEL} --access public + env: + NPM_LABEL: ${{ steps.get_npm_label.outputs.NPM_LABEL }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}