v5.10.1 #21
Workflow file for this run
This file contains hidden or 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
| name: Publish to npm | |
| on: | |
| release: | |
| types: [published] | |
| permissions: | |
| contents: read | |
| id-token: write | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| registry-url: 'https://registry.npmjs.org' | |
| # Ensure npm 11.5.1 or later for trusted publishing | |
| - run: npm install -g npm@latest | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Update package versions from release tag | |
| run: | | |
| TAG_VERSION=${GITHUB_REF#refs/tags/} | |
| TAG_VERSION=${TAG_VERSION#v} | |
| echo "Updating all packages to version $TAG_VERSION" | |
| # Update each package version | |
| for package_dir in packages/*/; do | |
| if [ -f "${package_dir}package.json" ]; then | |
| echo "Updating version in ${package_dir}package.json" | |
| cd "$package_dir" | |
| npm version $TAG_VERSION --no-git-tag-version --allow-same-version | |
| cd ../.. | |
| fi | |
| done | |
| - name: Build packages | |
| run: npm run build | |
| - name: Copy README to all packages | |
| run: | | |
| echo "Copying README.md to all packages" | |
| for package_dir in packages/*/; do | |
| if [ -f "${package_dir}package.json" ]; then | |
| echo "Copying README.md to ${package_dir}" | |
| cp README.md "${package_dir}README.md" | |
| fi | |
| done | |
| - name: Publish to npm using Changesets | |
| run: npx changeset publish --no-git-tag |