-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Publish package to JSR in addition to npm.
- Loading branch information
1 parent
7d0e83d
commit 3fe31b6
Showing
7 changed files
with
77 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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,19 @@ | ||
# Publish package to JSR. | ||
name: Publish to JSR | ||
on: [workflow_call] | ||
jobs: | ||
main: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
id-token: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: '20.x' | ||
registry-url: 'https://registry.npmjs.org' | ||
- run: npm ci | ||
# Can we get this to use “deno publish”? | ||
# - run: deno publish | ||
- run: npx jsr publish |
This file contains 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
This file contains 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
This file contains 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
This file contains 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,45 @@ | ||
#!/bin/bash | ||
|
||
# Wrapper around “npm version” which appends additional logic to also update the | ||
# “deno.json” file which controls how we publish to JSR. | ||
|
||
# Exit upon any failure. I.e., make script strictly sequential. | ||
set -e | ||
|
||
# Print current version information. | ||
npm version | ||
|
||
# Bail if we don’t have a version string for some reason. | ||
if [ -z "${1}" ] | ||
then | ||
echo "Pass in a version string (e.g., major, minor, 1.0.0-rc.58, 2.3.4, etc.)." | ||
exit 0 | ||
fi | ||
|
||
# Bump version in package.json using npm version itself. This ensures that we | ||
# stay anchored to first-class tooling. We pass “--git-tag-version=false” to | ||
# prevent the command from (1) committing changes and (2) creating a tag. | ||
prefixed_version="$(npm version --git-tag-version=false "${1}")" | ||
|
||
# The “npm version” command will return the value with a “v” prefix. Ditch that. | ||
version="${prefixed_version:1}" | ||
|
||
# Get pointers to files we need to manually update. | ||
root_directory="$(dirname "$(realpath "${0}")")" | ||
deno_json_file="${root_directory}/deno.json" | ||
package_json_file="${root_directory}/package.json" | ||
package_lock_json_file="${root_directory}/package-lock.json" | ||
|
||
# Bump version in deno.json. | ||
deno_json_find="\"version\": \"[^\"]*\"" | ||
deno_json_repl="\"version\": \"${version}\"" | ||
next_deno_json_file=$(sed "s/${deno_json_find}/${deno_json_repl}/g" "${deno_json_file}") | ||
echo "updating \"${deno_json_file}\"" | ||
echo "${next_deno_json_file}" > "${deno_json_file}" | ||
|
||
# Commit all our changes. | ||
git add "${package_json_file}" | ||
git add "${package_lock_json_file}" | ||
git add "${deno_json_file}" | ||
git commit --message="${version}" | ||
git tag --annotate "v${version}" --message="${version}" |
This file contains 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,5 @@ | ||
{ | ||
"name": "@netflix/x-element", | ||
"version": "1.0.0-rc.58", | ||
"exports": "./x-element.js" | ||
} |
This file contains 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