-
-
Notifications
You must be signed in to change notification settings - Fork 670
feat (npm_package): pack core and map into npm package #2084
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9735449
feat (npm_package): pack core and map into npm package
kongdd 0aa032c
fix maplibregl and desktop config
kongdd 6d7e3cb
style: auto-format (ruff + oxfmt) [pre-commit.ci]
pre-commit-ci[bot] 198b5ff
Address review feedback
giswqs fe6510f
Address CodeRabbit review feedback
giswqs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| name: Publish core and map packages | ||
|
|
||
| on: | ||
| release: | ||
| types: [published] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| publish: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| id-token: write # Required for npm trusted publishing and provenance. | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| with: | ||
| persist-credentials: false | ||
| - uses: actions/setup-node@v7 | ||
| with: | ||
| node-version: 24 | ||
| registry-url: https://registry.npmjs.org | ||
|
|
||
| # Trusted Publishing (OIDC) requires npm >= 11.5.1, which the runner's | ||
| # bundled npm is not guaranteed to be. Pin to a known-good version rather | ||
| # than `npm@latest`: that tag briefly shipped a build missing the bundled | ||
| # `sigstore` module, which breaks `npm publish --provenance`. | ||
| - name: Upgrade npm for Trusted Publishing | ||
| run: npm install -g npm@11.5.1 | ||
|
|
||
| - run: npm ci | ||
|
|
||
| - name: Build the distributed bundles | ||
| run: npm run build -w @geolibre/core -w @geolibre/map | ||
|
|
||
| # The manifests in git point at TypeScript source so the monorepo needs no | ||
| # build step; npm consumers need `dist`. npm ignores entry fields nested | ||
| # under `publishConfig`, so hoist them here, just before publishing. | ||
| # @geolibre/core is prepared alongside @geolibre/map so the `"*"` | ||
| # dependency between them is pinned to this release's version. | ||
| - name: Rewrite the manifests for publishing | ||
| run: node scripts/prepare-npm-package.mjs packages/core packages/map | ||
|
|
||
| # Each package is checked against its own version: the two move in | ||
| # lockstep today, but reading core's version for map would silently skip | ||
| # a map release (or attempt one npm has already seen) the moment they | ||
| # diverge. | ||
| - id: version | ||
| run: | | ||
| for pkg in core map; do | ||
| version=$(node -p "require('./packages/$pkg/package.json').version") | ||
| if npm view "@geolibre/$pkg@$version" version >/dev/null 2>&1; then | ||
| echo "$pkg=false" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "$pkg=true" >> "$GITHUB_OUTPUT" | ||
| fi | ||
| done | ||
|
|
||
| # No NODE_AUTH_TOKEN: npm authenticates via the OIDC id-token from the | ||
| # trusted publisher configured on each package (opengeos/GeoLibre, this | ||
| # workflow file) and attaches build provenance. npm has no PyPI-style | ||
| # pending publisher, so a package has to exist before that connection can | ||
| # be made: the first version is published from a maintainer's machine | ||
| # once, then every later release goes through here. | ||
| - name: Publish @geolibre/core | ||
| if: steps.version.outputs.core == 'true' | ||
| run: npm publish -w @geolibre/core --provenance --access public | ||
|
|
||
| # Published after core so a consumer installing @geolibre/map never | ||
| # resolves a pinned @geolibre/core that is not on the registry yet. | ||
| - name: Publish @geolibre/map | ||
| if: steps.version.outputs.map == 'true' | ||
| run: npm publish -w @geolibre/map --provenance --access public | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.