Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions .github/workflows/publish-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -395,14 +395,31 @@ jobs:
run: ls -lh bashkit.*.node bashkit.*.wasm 2>/dev/null || true
working-directory: crates/bashkit-js

- name: Publish
- name: Determine npm dist-tag
id: dist-tag
working-directory: crates/bashkit-js
run: |
PKG_VERSION=$(node -p "require('./package.json').version")
echo "version=$PKG_VERSION"

# Stable if triggered by a release tag, OR if workflow_dispatch
# and the version looks like a stable semver (no pre-release suffix).
if [[ "$GITHUB_REF" =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Publishing stable release"
echo "tag=latest" >> "$GITHUB_OUTPUT"
elif [[ "$PKG_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "tag=latest" >> "$GITHUB_OUTPUT"
else
echo "tag=next" >> "$GITHUB_OUTPUT"
fi

- name: Publish
run: |
TAG="${{ steps.dist-tag.outputs.tag }}"
echo "Publishing with dist-tag: $TAG"
if [ "$TAG" = "latest" ]; then
npm publish --provenance --access public
else
echo "Publishing pre-release with 'next' tag"
npm publish --provenance --tag next --access public
npm publish --provenance --tag "$TAG" --access public
fi
working-directory: crates/bashkit-js
env:
Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,19 @@ jobs:
draft: false
prerelease: false

# Note: the `release: [published]` event does NOT trigger other
# workflows when the release is created with GITHUB_TOKEN (GitHub
# prevents recursive workflow triggers). We must dispatch explicitly.
# Use --ref to set GITHUB_REF to the tag so publish-js correctly
# identifies stable releases.
- name: Trigger publish workflows
run: |
gh workflow run publish.yml
gh workflow run publish-python.yml
gh workflow run publish-js.yml
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="${{ steps.version.outputs.tag }}"
gh workflow run publish.yml --ref "$TAG"
gh workflow run publish-python.yml --ref "$TAG"
gh workflow run publish-js.yml --ref "$TAG"

- name: Trigger CLI binary builds for release tag
env:
Expand Down
Loading