From eaf0f7c199e71a20e6b15d00150b5574f5e44b3a Mon Sep 17 00:00:00 2001 From: Jonathan Lurie Date: Mon, 18 Nov 2024 12:00:21 +0100 Subject: [PATCH] Github action for beta version publishing on NPM (#135) --- .github/workflows/format-lint.yml | 4 ++-- .github/workflows/npm-publish.yml | 21 ++++++++++++++++++--- CHANGELOG.md | 6 ++++++ 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/.github/workflows/format-lint.yml b/.github/workflows/format-lint.yml index ef14d48..fc8d9f9 100644 --- a/.github/workflows/format-lint.yml +++ b/.github/workflows/format-lint.yml @@ -7,10 +7,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out Git repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 18 diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 26361a7..427d5a2 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -11,13 +11,28 @@ jobs: build-and-publish: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - name: Checkout repo + uses: actions/checkout@v4 + with: + ref: ${{ github.event.release.target_commitish }} + + - uses: actions/setup-node@v4 with: node-version: 18 registry-url: https://registry.npmjs.org/ - run: npm ci - run: npm run make - - run: npm publish --access public + + - name: Publish NPM package (regular) + if: "!github.event.release.prerelease" + run: | + npm publish + env: + NODE_AUTH_TOKEN: ${{secrets.npm_token}} + + - name: Publish NPM package (pre-release) + if: "github.event.release.prerelease" + run: | + npm publish --tag next env: NODE_AUTH_TOKEN: ${{secrets.npm_token}} diff --git a/CHANGELOG.md b/CHANGELOG.md index eccd094..547c91c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ ### Bug Fixes - The language switching is now more robust and preserves the original formatting from the style (`Map.setPrimaryLangage()`) (https://github.com/maptiler/maptiler-sdk-js/pull/134) +### Others +- Now able to GitHub action a beta on NPM from the GH release creation process +- Updated GH action to v4 + + + ## 2.4.1 ### Bug Fixes - The class `AJAXError` is now imported as part of the `maplibregl` namespace (CommonJS limitation from Maplibre GL JS) (https://github.com/maptiler/maptiler-sdk-js/pull/129)