diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..801176f --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,26 @@ +name: Publish to NPM +on: + release: + types: [published] +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: 16 + cache: 'yarn' + - name: Install dependencies + run: yarn install --frozen-lockfile + - name: Get the release tag version + id: get_version + run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} + - name: Set package version + run: yarn version --new-version "${{ steps.get_version.outputs.VERSION }}" --no-git-tag-version + - name: Publish package + run: yarn publish --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}