From 246d552117a180a0bd3bd751368a36bee0a4f468 Mon Sep 17 00:00:00 2001 From: Mats Blomdahl Date: Sun, 23 Oct 2022 15:07:25 +0200 Subject: [PATCH] Finding GHP Rejects Un-Scoped NPM :package: (#93) After merging #94, we find that GitHub Packages \[GHP\], does not accept publishing of un-scoped packages. Instead of giving up on GHP entirely, let's publish this under two different names: 1. On NPM, as always, it's the `mapbox-gl-circle` package 2. On GHP, it's the same code as on NPM but published as the "`@smithmicro/mapbox-gl-circle`" package --- .github/workflows/publish-prerelease.yml | 29 +++++++++++++++--------- .github/workflows/publish-release.yml | 29 +++++++++++++++--------- package-lock.json | 4 ++-- package.json | 2 +- 4 files changed, 39 insertions(+), 25 deletions(-) diff --git a/.github/workflows/publish-prerelease.yml b/.github/workflows/publish-prerelease.yml index 53d227f..6fe48b8 100644 --- a/.github/workflows/publish-prerelease.yml +++ b/.github/workflows/publish-prerelease.yml @@ -34,25 +34,32 @@ jobs: CHANGELOG_SECTION="### v. $(echo $BUILD_VERSION | cut -d- -f1)" echo "Ensure changelog has a '$CHANGELOG_SECTION' section ..." && grep -Fq "$CHANGELOG_SECTION" README.md - # Build package + # Build API documentation + npm run docs + + # Build and publish to GHP + npm pkg set name=@smithmicro/mapbox-gl-circle + npm install rm -rf dist/ npm run browserify npm run prepare - npm run docs - - # Publish to NPM - echo 'registry=https://registry.npmjs.org' >> .npmrc - echo '//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}' >> .npmrc + echo 'registry=https://npm.pkg.github.com' >> .npmrc + echo '//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}' >> .npmrc npm publish --tag=next --access=public git restore .npmrc - echo "Pre-release $BUILD_VERSION published to NPM." + echo "Pre-release @smithmicro/mapbox-gl-circle-$BUILD_VERSION published to GHP." - # Publish to GHP - echo 'registry=https://npm.pkg.github.com' >> .npmrc - echo '//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}' >> .npmrc + # Build and publish to NPM + npm pkg set name=mapbox-gl-circle + npm install + rm -rf dist/ + npm run browserify + npm run prepare + echo 'registry=https://registry.npmjs.org' >> .npmrc + echo '//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}' >> .npmrc npm publish --tag=next --access=public git restore .npmrc - echo "Pre-release $BUILD_VERSION published to GHP." + echo "Pre-release mapbox-gl-circle-$BUILD_VERSION published to NPM." git config --local user.email "actions@github.com" git config --local user.name "GitHub Actions" diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 2ce1d6f..3ef737f 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -30,25 +30,32 @@ jobs: CHANGELOG_SECTION="### v. $BUILD_VERSION" echo "Ensure changelog has a '$CHANGELOG_SECTION' section ..." && grep -Fq "$CHANGELOG_SECTION" README.md - # Build package + # Build API documentation + npm run docs + + # Build and publish to GHP + npm pkg set name=@smithmicro/mapbox-gl-circle + npm install rm -rf dist/ npm run browserify npm run prepare - npm run docs - - # Publish to NPM - echo 'registry=https://registry.npmjs.org' >> .npmrc - echo '//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}' >> .npmrc + echo 'registry=https://npm.pkg.github.com' >> .npmrc + echo '//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}' >> .npmrc npm publish --tag=latest --access=public git restore .npmrc - echo "Release $BUILD_VERSION published to NPM." + echo "Release @smithmicro/mapbox-gl-circle-$BUILD_VERSION published to GHP." - # Publish to GHP - echo 'registry=https://npm.pkg.github.com' >> .npmrc - echo '//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}' >> .npmrc + # Build and publish to NPM + npm pkg set name=mapbox-gl-circle + npm install + rm -rf dist/ + npm run browserify + npm run prepare + echo 'registry=https://registry.npmjs.org' >> .npmrc + echo '//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}' >> .npmrc npm publish --tag=latest --access=public git restore .npmrc - echo "Release $BUILD_VERSION published to GHP." + echo "Release mapbox-gl-circle-$BUILD_VERSION published to NPM." git config --local user.email "actions@github.com" git config --local user.name "GitHub Actions" diff --git a/package-lock.json b/package-lock.json index dc4fe75..18cf0ab 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "mapbox-gl-circle", - "version": "1.6.5", + "version": "1.6.6-0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "mapbox-gl-circle", - "version": "1.6.5", + "version": "1.6.6-0", "license": "ISC", "dependencies": { "@turf/bbox": "^4.7.3", diff --git a/package.json b/package.json index fc4046c..f2d19e0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mapbox-gl-circle", - "version": "1.6.5", + "version": "1.6.6-0", "author": "Smith Micro Software, Inc.", "license": "ISC", "description": "A google.maps.Circle replacement for Mapbox GL JS API",