Skip to content

Commit

Permalink
Finding GHP Rejects Un-Scoped NPM 📦 (smithmicro#93)
Browse files Browse the repository at this point in the history
After merging smithmicro#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
  • Loading branch information
mblomdahl committed Oct 23, 2022
1 parent 8091b9c commit d5692f9
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 25 deletions.
29 changes: 18 additions & 11 deletions .github/workflows/publish-prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 docs
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"
Expand Down
29 changes: 18 additions & 11 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 docs
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"
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit d5692f9

Please sign in to comment.