Merge pull request #53 from Reef-Network/staging #191
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: CI | |
| on: | |
| push: | |
| branches: [main, staging] | |
| pull_request: | |
| branches: [main, staging] | |
| jobs: | |
| build-and-test: | |
| name: Build & Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Lint | |
| run: npm run lint | |
| - name: Check formatting | |
| run: npm run format:check | |
| - name: Build all packages | |
| run: npm run build | |
| - name: Test protocol | |
| run: npx vitest run | |
| working-directory: protocol | |
| - name: Test client | |
| run: npx vitest run | |
| working-directory: client | |
| - name: Test directory | |
| run: npx vitest run | |
| working-directory: directory | |
| publish: | |
| name: Publish to npm | |
| needs: build-and-test | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| registry-url: https://registry.npmjs.org | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build all packages | |
| run: npm run build | |
| - name: Publish protocol (if version changed) | |
| working-directory: protocol | |
| run: | | |
| LOCAL=$(node -p "require('./package.json').version") | |
| REMOTE=$(npm view @reef-protocol/protocol version 2>/dev/null || echo "0.0.0") | |
| if [ "$LOCAL" != "$REMOTE" ]; then | |
| echo "Publishing @reef-protocol/protocol@$LOCAL (was $REMOTE)" | |
| npm publish --access public --provenance | |
| else | |
| echo "@reef-protocol/protocol@$LOCAL already published, skipping" | |
| fi | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Publish client (if version changed) | |
| working-directory: client | |
| run: | | |
| LOCAL=$(node -p "require('./package.json').version") | |
| REMOTE=$(npm view @reef-protocol/client version 2>/dev/null || echo "0.0.0") | |
| if [ "$LOCAL" != "$REMOTE" ]; then | |
| echo "Publishing @reef-protocol/client@$LOCAL (was $REMOTE)" | |
| npm publish --access public --provenance | |
| else | |
| echo "@reef-protocol/client@$LOCAL already published, skipping" | |
| fi | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Publish openclaw plugin (if version changed) | |
| working-directory: openclaw | |
| run: | | |
| LOCAL=$(node -p "require('./package.json').version") | |
| REMOTE=$(npm view @reef-protocol/reef-openclaw version 2>/dev/null || echo "0.0.0") | |
| if [ "$LOCAL" != "$REMOTE" ]; then | |
| echo "Publishing @reef-protocol/reef-openclaw@$LOCAL (was $REMOTE)" | |
| npm publish --access public --provenance | |
| else | |
| echo "@reef-protocol/reef-openclaw@$LOCAL already published, skipping" | |
| fi | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |