From 301a941d8f86380f5bdba1300b8cb8efc2315c32 Mon Sep 17 00:00:00 2001 From: Michiel Lankamp Date: Fri, 13 Jan 2023 15:08:45 +0100 Subject: [PATCH] added release WF --- .github/workflows/release.yaml | 51 ++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000000..cbbc8813b9 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,51 @@ +name: Release + +on: + release: + types: [published] + + +jobs: + setup: + runs-on: ubuntu-latest + outputs: + version: ${{ steps.trim.outputs.version }} + steps: + - id: trim + run: echo "::set-output name=version::${TAG:1}" + env: + TAG: ${{ github.event.release.tag_name }} + + release: + needs: setup + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Use Node.js + uses: actions/setup-node@v3 + with: + registry-url: https://registry.npmjs.org/ + + - name: Restore + run: npm ci + + - name: Setup and build + run: | + npm install -g json + json -I -f package.json -e "this.version=\"$VERSION\"" + npm run build + npm pack + env: + VERSION: ${{ needs.setup.outputs.version }} + + - name: Publish to NPM + run: | + npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + \ No newline at end of file