Move Node.js package.json to platform/node (#2343)

Co-authored-by: Andrew Calcutt <acalcutt@techidiots.net>
This commit is contained in:
Bart Louwers
2024-07-10 16:15:26 +02:00
committed by GitHub
parent a34817c4a7
commit 41ff7c3b0d
14 changed files with 137 additions and 456 deletions

View File

@@ -24,6 +24,7 @@ jobs:
- name: Check if version is published
id: check
working-directory: platform/node
run: |
currentVersion="$( node -e "console.log(require('./package.json').version)" )"
isPublished="$( npm view @maplibre/maplibre-gl-native versions --json | jq -c --arg cv "$currentVersion" 'any(. == $cv)' )"
@@ -231,21 +232,23 @@ jobs:
- name: Publish X64 Release to Github
if: matrix.arch == 'x86_64'
working-directory: platform/node
env:
PUBLISH: true
BUILDTYPE: RelWithDebInfo
NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
./platform/node/scripts/publish.sh
./scripts/publish.sh
- name: Publish ARM Release to Github
if: matrix.arch == 'arm64'
working-directory: platform/node
env:
PUBLISH: true
BUILDTYPE: RelWithDebInfo
NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
./platform/node/scripts/publish.sh --target_arch=arm64
./scripts/publish.sh --target_arch=arm64
publish_npm:
runs-on: ubuntu-latest
@@ -269,12 +272,16 @@ jobs:
- name: Get version
id: package-version
uses: martinbeentjes/npm-get-version-action@v1.3.1
with:
path: platform/node
- name: npm ci
working-directory: platform/node
run: npm ci --ignore-scripts
- name: Prepare release
id: prepare_release
working-directory: platform/node
run: |
RELEASE_TYPE="$(node -e "console.log(require('semver').prerelease('${{ steps.package-version.outputs.current-version }}') ? 'prerelease' : 'regular')")"
if [[ $RELEASE_TYPE == 'regular' ]]; then
@@ -284,8 +291,9 @@ jobs:
fi
- name: Extract changelog for version
working-directory: platform/node
run: |
awk '/^##/ { p = 0 }; p == 1 { print }; $0 == "## ${{ steps.package-version.outputs.current-version }}" { p = 1 };' platform/node/CHANGELOG.md > changelog_for_version.md
awk '/^##/ { p = 0 }; p == 1 { print }; $0 == "## ${{ steps.package-version.outputs.current-version }}" { p = 1 };' CHANGELOG.md > changelog_for_version.md
cat changelog_for_version.md
- name: Update Release Notes
@@ -296,13 +304,14 @@ jobs:
with:
tag: node-v${{ steps.package-version.outputs.current-version }}
name: node-v${{ steps.package-version.outputs.current-version }}
bodyFile: changelog_for_version.md
bodyFile: platform/node/changelog_for_version.md
allowUpdates: true
draft: false
prerelease: ${{ steps.prepare_release.outputs.prerelease }}
- name: Publish to NPM (release)
if: ${{ steps.prepare_release.outputs.prerelease == 'false' }}
working-directory: platform/node
run: |
npm config set //registry.npmjs.org/:_authToken "${NPM_TOKEN}"
npm publish --access public
@@ -311,6 +320,7 @@ jobs:
- name: Publish to NPM (prerelease)
if: ${{ steps.prepare_release.outputs.prerelease == 'true' }}
working-directory: platform/node
run: |
npm config set //registry.npmjs.org/:_authToken "${NPM_TOKEN}"
npm publish --tag next --access public