diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..addf5d3 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,48 @@ +name: Release +on: + workflow_dispatch: + inputs: + tag: + type: choice + description: Tag + required: true + options: + - beta + - latest + - alpha + +jobs: + build-publish: + name: Build & publish + runs-on: ubuntu-latest + steps: + - name: Cancel previous runs + uses: styfle/cancel-workflow-action@0.12.1 + with: + access_token: ${{ github.token }} + + - name: Checkout + uses: actions/checkout@v3 + + - name: Install node + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Install dependencies + run: npm ci + + - name: Build + run: npm run build + + - name: Write npm credentials + run: | + echo "//registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN" >> .npmrc + npm whoami + env: + NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} + + - name: Release + run: npm publish --tag ${{ github.event.inputs.tag }} --access public + env: + NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}