Repository navigation
REPLY-51256: reply-cli v1 — auth, profiles, team headers, packaging #2
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: dev-build | |
| # On a PR to main: install, build and unit-test only (no publish). | |
| # On push to main (or manual dispatch): after tests pass, auto-bump the patch, | |
| # publish @reply-team/reply-cli to GitHub Packages, and tag the commit v<version>. | |
| # | |
| # Versioning is plain semver with NO prerelease suffix and NO dev dist-tag — the | |
| # internal package name (@reply-team/reply-cli) and binary (replyrc) already | |
| # distinguish it from the public build. major.minor come from package.json; | |
| # patch = highest existing v<major>.<minor>.* tag + 1 (contiguous 0.1.1, 0.1.2…). | |
| # The public build is released later from the SAME tag with the public identity, | |
| # giving the same version number rebuilt as `reply-cli`. | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write # push version tags | |
| packages: write # publish to GitHub Packages | |
| # Serialize main publishes (constant group on refs/heads/main) so two merges | |
| # can't grab the same patch number; PRs get a unique group and run freely. | |
| concurrency: | |
| group: dev-build-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| # Force the dev identity for the whole job so the gen-app-name prebuild/ | |
| # pretest hooks stamp APP_NAME=replyrc before build and test. | |
| env: | |
| APP_NAME: replyrc | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| registry-url: https://npm.pkg.github.com | |
| scope: '@reply-team' | |
| - name: Install | |
| run: npm ci | |
| - name: Build | |
| run: npm run build | |
| - name: Unit tests | |
| run: npm test | |
| - name: Compute next version | |
| if: ${{ github.event_name != 'pull_request' }} | |
| run: | | |
| MM=$(node -p "require('./package.json').version.split('.').slice(0,2).join('.')") | |
| LAST=$(git tag -l "v${MM}.*" | sed "s|^v${MM}\.||" | grep -E '^[0-9]+$' | sort -n | tail -1) | |
| NEXT=$(( ${LAST:-0} + 1 )) | |
| VERSION="${MM}.${NEXT}" | |
| echo "VERSION=$VERSION" >> "$GITHUB_ENV" | |
| echo "Next version: $VERSION (previous patch on $MM: ${LAST:-none})" | |
| - name: Set version and dev identity | |
| if: ${{ github.event_name != 'pull_request' }} | |
| run: | | |
| npm pkg set version="$VERSION" | |
| npm pkg set name="@reply-team/reply-cli" | |
| npm pkg delete bin | |
| npm pkg set bin.replyrc="dist/index.js" | |
| npm pkg set publishConfig.registry="https://npm.pkg.github.com" | |
| - name: Publish to GitHub Packages | |
| if: ${{ github.event_name != 'pull_request' }} | |
| run: npm publish | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Tag the released commit | |
| if: ${{ github.event_name != 'pull_request' }} | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git tag -a "v$VERSION" -m "@reply-team/reply-cli@$VERSION" | |
| git push origin "v$VERSION" |