π CLI Release Publish #27
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: π CLI Release Publish | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| build_version: | |
| description: 'Build version to install (e.g., 0.0.0-build-commitsha-20250815025358)' | |
| required: true | |
| type: string | |
| chosen_version: | |
| description: 'Version to set in package.json (e.g., 0.1.0-alpha.1)' | |
| required: true | |
| type: string | |
| jobs: | |
| cli-release-publish: | |
| name: π CLI Release Publish | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| id-token: write | |
| steps: | |
| - name: π₯ Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.PAT_DEPLOY }} | |
| - name: π’ Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: π Setup npm auth | |
| run: | | |
| echo "registry=https://registry.npmjs.org" >> ~/.npmrc | |
| echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc | |
| env: | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: π§ Configure Git | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: π¦ Install CLI package | |
| run: | | |
| cd packages/xyd-js | |
| echo "Installing @xyd-js/cli@${{ github.event.inputs.build_version }} --save-exact" | |
| npm install @xyd-js/cli@${{ github.event.inputs.build_version }} --save-exact | |
| - name: π Update package version | |
| run: | | |
| cd packages/xyd-js | |
| echo "Updating package.json version to ${{ github.event.inputs.chosen_version }}" | |
| npm version ${{ github.event.inputs.chosen_version }} --no-git-tag-version | |
| - name: π Verify changes | |
| run: | | |
| cd packages/xyd-js | |
| echo "Current package.json version:" | |
| node -p "require('./package.json').version" | |
| echo "Current @xyd-js/cli dependency:" | |
| node -p "require('./package.json').dependencies['@xyd-js/cli']" | |
| - name: π Commit and push changes | |
| run: | | |
| git add packages/xyd-js/package.json packages/xyd-js/package-lock.json | |
| git commit -m "chore(release): π v${{ github.event.inputs.chosen_version }} π" | |
| git remote set-url origin https://x-access-token:${{ secrets.PAT_DEPLOY }}@github.com/${{ github.repository }}.git | |
| git push origin master | |
| - name: π·οΈ Create and push tag | |
| run: | | |
| git tag v${{ github.event.inputs.chosen_version }} | |
| git push origin v${{ github.event.inputs.chosen_version }} | |
| - name: β Success message | |
| run: | | |
| echo "β Successfully published CLI release!" | |
| echo "π¦ Build version installed: ${{ github.event.inputs.build_version }}" | |
| echo "π·οΈ Package version updated to: ${{ github.event.inputs.chosen_version }}" | |
| echo "π Tag created: v${{ github.event.inputs.chosen_version }}" |