diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c41e9d5..9250b4b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,8 +25,8 @@ jobs: - name: Setup Deno uses: denoland/setup-deno@v1.1.2 - - name: NPM install with caching - run: npm install + - name: NPM install + run: npm ci - name: Build run: npm run build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..b32b932 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,47 @@ +name: Publish package to NPM + +on: + push: + tags: + - 'v*' + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + rust: + - stable + + steps: + - uses: actions/checkout@v3 + + - name: Setup Node.js environment + uses: actions/setup-node@v3.8.1 + + - name: Setup Deno + uses: denoland/setup-deno@v1.1.2 + + - name: NPM install + run: npm ci + + - name: Build + run: npm run build + + - name: Node Test + run: npm run test + + - name: Deno Test + run: deno test -A ./tests/mod.test.ts + + - name: Update package version + run: | + tag="${{ github.ref }}" + tag="${tag/refs\/tags\/v/}" + npm version $tag --no-git-tag-version --no-commit-hooks + + - name: NPM Publish + uses: JS-DevTools/npm-publish@v2.2.2 + with: + token: ${{ secrets.NPM_TOKEN }} \ No newline at end of file