mirror of
https://github.com/Xahau/xahau.js.git
synced 2026-06-07 10:46:49 +00:00
Compare commits
4 Commits
workflow-p
...
xahau@4.0.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4918e914c5 | ||
|
|
7552ae8635 | ||
|
|
fd100f6e92 | ||
|
|
587a75403a |
102
.github/workflows/npm-publish.yml
vendored
Normal file
102
.github/workflows/npm-publish.yml
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
name: Publish npm packages
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
concurrency:
|
||||
group: npm-publish-${{ github.event.release.tag_name }}
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
name: Publish ${{ github.event.release.tag_name }}
|
||||
runs-on: ubuntu-latest
|
||||
environment: npm
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
steps:
|
||||
- id: release
|
||||
name: Resolve package from tag
|
||||
shell: bash
|
||||
run: |
|
||||
case "$RELEASE_TAG" in
|
||||
xahau@*) package_path="packages/xahau" ;;
|
||||
xahau-address-codec@*) package_path="packages/xahau-address-codec" ;;
|
||||
xahau-binary-codec@*) package_path="packages/xahau-binary-codec" ;;
|
||||
xahau-keypairs@*) package_path="packages/xahau-keypairs" ;;
|
||||
*)
|
||||
echo "Unsupported release tag: $RELEASE_TAG" >&2
|
||||
echo "Expected xahau@<version>, xahau-address-codec@<version>, xahau-binary-codec@<version>, or xahau-keypairs@<version>." >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "package-path=$package_path" >> "$GITHUB_OUTPUT"
|
||||
env:
|
||||
RELEASE_TAG: ${{ github.event.release.tag_name }}
|
||||
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
ref: ${{ github.event.release.tag_name }}
|
||||
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: "20"
|
||||
registry-url: https://registry.npmjs.org
|
||||
package-manager-cache: false
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Build package
|
||||
run: npm run build
|
||||
|
||||
- id: package
|
||||
name: Read package metadata
|
||||
shell: bash
|
||||
run: |
|
||||
package_json="${{ steps.release.outputs.package-path }}/package.json"
|
||||
name="$(jq -r .name "$package_json")"
|
||||
version="$(jq -r .version "$package_json")"
|
||||
tag="$name@$version"
|
||||
|
||||
{
|
||||
echo "name=$name"
|
||||
echo "version=$version"
|
||||
echo "tag=$tag"
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Check release tag matches package version
|
||||
shell: bash
|
||||
run: |
|
||||
if [[ "$RELEASE_TAG" != "$PACKAGE_TAG" ]]; then
|
||||
echo "Release tag $RELEASE_TAG does not match package tag $PACKAGE_TAG." >&2
|
||||
exit 1
|
||||
fi
|
||||
env:
|
||||
RELEASE_TAG: ${{ github.event.release.tag_name }}
|
||||
PACKAGE_TAG: ${{ steps.package.outputs.tag }}
|
||||
|
||||
- name: Check package version is unpublished
|
||||
shell: bash
|
||||
run: |
|
||||
package_spec="${{ steps.package.outputs.tag }}"
|
||||
stderr_file="$(mktemp)"
|
||||
|
||||
if npm view "$package_spec" version --registry https://registry.npmjs.org 2>"$stderr_file"; then
|
||||
echo "$package_spec is already published." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if grep -Eq "E404|404 Not Found|is not in this registry" "$stderr_file"; then
|
||||
echo "$package_spec is not published yet."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
cat "$stderr_file" >&2
|
||||
exit 1
|
||||
|
||||
- name: Publish to npm
|
||||
run: npm publish --workspace "${{ steps.release.outputs.package-path }}" --registry https://registry.npmjs.org
|
||||
14
package-lock.json
generated
14
package-lock.json
generated
@@ -2724,9 +2724,6 @@
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"glibc"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -2741,9 +2738,6 @@
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"musl"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -2758,9 +2752,6 @@
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"glibc"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -2775,9 +2766,6 @@
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"musl"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -16060,7 +16048,7 @@
|
||||
}
|
||||
},
|
||||
"packages/xahau": {
|
||||
"version": "4.0.3",
|
||||
"version": "4.0.4-alpha.1",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@scure/bip32": "^1.3.1",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xahau",
|
||||
"version": "4.0.3",
|
||||
"version": "4.0.4-alpha.1",
|
||||
"license": "ISC",
|
||||
"description": "A TypeScript/JavaScript API for interacting with the Xahau Network in Node.js and the browser",
|
||||
"files": [
|
||||
|
||||
Reference in New Issue
Block a user