chore: add bump script #86
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: Release Monorepo Packages | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - '@chimp-stack/*@*' # Triggers only on scoped version tags | |
| permissions: | |
| contents: write | |
| jobs: | |
| release: | |
| name: Build and Publish ${{ matrix.package }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| package: | |
| - chimp-core | |
| - git-chimp | |
| - doc-chimp | |
| - release-chimp | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Required for tag detection | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| registry-url: 'https://registry.npmjs.org/' | |
| - name: Configure npm auth | |
| run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build and Publish if New | |
| working-directory: packages/${{ matrix.package }} | |
| run: | | |
| PACKAGE_NAME=$(node -p "require('./package.json').name") | |
| CURRENT_VERSION=$(node -p "require('./package.json').version") | |
| PUBLISHED_VERSION=$(npm view $PACKAGE_NAME version || echo "0.0.0") | |
| echo "π¦ Package: $PACKAGE_NAME" | |
| echo "π Current Version: $CURRENT_VERSION" | |
| echo "π¬ Published Version: $PUBLISHED_VERSION" | |
| if [ "$CURRENT_VERSION" = "$PUBLISHED_VERSION" ]; then | |
| echo "β© Skipping β already published." | |
| exit 0 | |
| fi | |
| echo "π¨ Building $PACKAGE_NAME..." | |
| npm run build | |
| echo "π Publishing $PACKAGE_NAME@$CURRENT_VERSION..." | |
| npm publish --access public | |
| env: | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |