mirror of
https://github.com/Xahau/xahau.js.git
synced 2026-06-03 08:46:40 +00:00
Add GitHub Actions workflow for npm trusted publishing via OIDC. The workflow validates package version bumps on PRs with npm publish dry-runs, publishes changed workspace packages from main-xahau, and creates matching GitHub releases. Shared npm publish logic is implemented as a local composite action used by both dry-run and publish jobs.
24 lines
592 B
Bash
24 lines
592 B
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
package_path="$1"
|
|
package_file="$package_path/package.json"
|
|
current_version="$(jq -r .version "$package_file")"
|
|
changed="false"
|
|
|
|
if [[ -z "${BASE_REF:-}" || "${BASE_REF:-}" =~ ^0+$ ]]; then
|
|
BASE_REF="HEAD^"
|
|
fi
|
|
|
|
if previous_package="$(git show "$BASE_REF:$package_file" 2>/dev/null)"; then
|
|
previous_version="$(jq -r .version <<<"$previous_package")"
|
|
if [[ "$current_version" != "$previous_version" ]]; then
|
|
changed="true"
|
|
fi
|
|
else
|
|
changed="true"
|
|
fi
|
|
|
|
echo "changed=$changed" >> "$GITHUB_OUTPUT"
|
|
echo "$package_path version changed: $changed"
|