Repository navigation
REPLY-51256: reply-cli v1 — auth, profiles, team headers, packaging #6
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: build | |
| # On a PR to main: install, build, unit-test on Linux + Windows (no publish). | |
| # On push to main (or manual dispatch): after tests pass, publish a new build | |
| # to GitHub Packages under the `next` dist-tag (from Ubuntu only). Versions are | |
| # plain semver (major.minor from package.json; patch = highest published + 1), | |
| # so testers can install ANY build: `@reply-team/reply-cli@0.1.42` or `@next`. | |
| # Promotion to `@latest` is handled by the separate release workflow. | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| packages: write | |
| # Serialize main publishes so two merges can't grab the same patch number. | |
| concurrency: | |
| group: build-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| 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 | |
| # Publish only from a single OS (Ubuntu) on push/dispatch — never on PRs, | |
| # never twice. | |
| - name: Compute next @next version | |
| if: ${{ github.event_name != 'pull_request' && matrix.os == 'ubuntu-latest' }} | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| MM=$(node -p "require('./package.json').version.split('.').slice(0,2).join('.')") | |
| PUB=$(npm view "@reply-team/reply-cli" versions --json 2>/dev/null || echo '[]') | |
| NEXT=$(PUB="$PUB" MM="$MM" node -e "const mm=process.env.MM;let vs=[];try{vs=JSON.parse(process.env.PUB)}catch{}; if(!Array.isArray(vs)) vs = vs ? [vs] : []; const ps=vs.filter(v=>typeof v==='string'&&v.startsWith(mm+'.')).map(v=>parseInt(v.slice(mm.length+1),10)).filter(Number.isInteger); process.stdout.write(String(ps.length?Math.max(...ps)+1:0))") | |
| VERSION="${MM}.${NEXT}" | |
| echo "VERSION=$VERSION" >> "$GITHUB_ENV" | |
| echo "Publishing $VERSION under @next" | |
| - name: Publish to GitHub Packages (@next) | |
| if: ${{ github.event_name != 'pull_request' && matrix.os == 'ubuntu-latest' }} | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| npm version "$VERSION" --no-git-tag-version --allow-same-version | |
| npm pkg set commit="${{ github.sha }}" | |
| npm publish --tag next |