Skip to content

v0.11.10

v0.11.10 #56

Workflow file for this run

name: Release to GitHub and NPM
on:
release:
types: [published]
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write # Need write access to push commits
id-token: write # For npm provenance
steps:
- name: Checkout main branch
uses: actions/checkout@v4
with:
ref: main
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Verify we're on main branch
run: |
echo "Current branch: $(git branch --show-current)"
echo "Current HEAD: $(git rev-parse HEAD)"
echo "Current version: $(node -p "require('./package.json').version")"
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22.x'
cache: 'npm'
registry-url: 'https://registry.npmjs.org'
scope: '@atxp'
- name: Update package.json versions
run: |
# Remove 'v' prefix if present (v1.2.3 → 1.2.3)
VERSION=${{ github.event.release.tag_name }}
VERSION=${VERSION#v}
# Configure git
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
# Check current version in root package.json
CURRENT_VERSION=$(node -p "require('./package.json').version")
if [ "$CURRENT_VERSION" = "$VERSION" ]; then
echo "Version is already $VERSION, skipping version bump"
exit 0
fi
echo "Updating version from $CURRENT_VERSION to $VERSION"
# Update package versions without running npm version's implicit install
# per workspace. The implicit installs can create nested packages/*/node_modules
# entries that shadow local workspaces with already-published packages.
npm pkg set version=$VERSION
# Update all workspace package versions
npm pkg set version=$VERSION -w packages/atxp-common
npm pkg set version=$VERSION -w packages/atxp-sqlite
npm pkg set version=$VERSION -w packages/atxp-redis
npm pkg set version=$VERSION -w packages/atxp-server
npm pkg set version=$VERSION -w packages/atxp-client
npm pkg set version=$VERSION -w packages/atxp-base
npm pkg set version=$VERSION -w packages/atxp-solana
npm pkg set version=$VERSION -w packages/atxp-worldchain
npm pkg set version=$VERSION -w packages/atxp-polygon
npm pkg set version=$VERSION -w packages/atxp-express
npm pkg set version=$VERSION -w packages/atxp-cloudflare
npm pkg set version=$VERSION -w packages/atxp-x402
npm pkg set version=$VERSION -w packages/atxp-mpp
npm pkg set version=$VERSION -w packages/atxp-tempo
# Update cross-package dependencies to match new version
npm pkg set dependencies."@atxp/common"=$VERSION -w packages/atxp-client
npm pkg set dependencies."@atxp/mpp"=$VERSION -w packages/atxp-client
npm pkg set dependencies."@atxp/common"=$VERSION -w packages/atxp-server
npm pkg set dependencies."@atxp/mpp"=$VERSION -w packages/atxp-server
npm pkg set dependencies."@atxp/common"=$VERSION -w packages/atxp-sqlite
npm pkg set dependencies."@atxp/common"=$VERSION -w packages/atxp-redis
npm pkg set dependencies."@atxp/common"=$VERSION -w packages/atxp-base
npm pkg set dependencies."@atxp/client"=$VERSION -w packages/atxp-base
npm pkg set dependencies."@atxp/common"=$VERSION -w packages/atxp-solana
npm pkg set dependencies."@atxp/client"=$VERSION -w packages/atxp-solana
npm pkg set dependencies."@atxp/common"=$VERSION -w packages/atxp-worldchain
npm pkg set dependencies."@atxp/client"=$VERSION -w packages/atxp-worldchain
npm pkg set dependencies."@atxp/common"=$VERSION -w packages/atxp-polygon
npm pkg set dependencies."@atxp/client"=$VERSION -w packages/atxp-polygon
npm pkg set dependencies."@atxp/common"=$VERSION -w packages/atxp-tempo
npm pkg set dependencies."@atxp/client"=$VERSION -w packages/atxp-tempo
npm pkg set dependencies."@atxp/server"=$VERSION -w packages/atxp-express
npm pkg set dependencies."@atxp/common"=$VERSION -w packages/atxp-cloudflare
npm pkg set dependencies."@atxp/server"=$VERSION -w packages/atxp-cloudflare
npm pkg set dependencies."@atxp/base"=$VERSION -w packages/atxp-x402
npm pkg set dependencies."@atxp/client"=$VERSION -w packages/atxp-x402
npm pkg set dependencies."@atxp/common"=$VERSION -w packages/atxp-x402
# Regenerate package-lock.json with updated versions
npm install
- name: Build
run: npm run build
- name: Run tests
run: npm test
- name: Publish packages to NPM
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
# Publish all workspace packages (order matters for dependencies).
# --ignore-existing skips already-published versions so re-runs are safe.
PUBLISH_FLAGS="--provenance --access public --ignore-existing"
npm publish -w packages/atxp-common $PUBLISH_FLAGS
npm publish -w packages/atxp-sqlite $PUBLISH_FLAGS
npm publish -w packages/atxp-redis $PUBLISH_FLAGS
npm publish -w packages/atxp-mpp $PUBLISH_FLAGS
npm publish -w packages/atxp-server $PUBLISH_FLAGS
npm publish -w packages/atxp-client $PUBLISH_FLAGS
npm publish -w packages/atxp-base $PUBLISH_FLAGS
npm publish -w packages/atxp-solana $PUBLISH_FLAGS
npm publish -w packages/atxp-worldchain $PUBLISH_FLAGS
npm publish -w packages/atxp-polygon $PUBLISH_FLAGS
npm publish -w packages/atxp-tempo $PUBLISH_FLAGS
npm publish -w packages/atxp-express $PUBLISH_FLAGS
npm publish -w packages/atxp-cloudflare $PUBLISH_FLAGS
npm publish -w packages/atxp-x402 $PUBLISH_FLAGS
- name: Commit version bump and push
continue-on-error: true
run: |
VERSION=${{ github.event.release.tag_name }}
VERSION=${VERSION#v}
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add -A
git diff --cached --quiet || git commit -m "bump version to $VERSION [skip ci]"
git pull --rebase origin main || (git rebase --abort && echo "Rebase failed, but continuing")
git push origin main || echo "Push failed, but packages were published successfully"