|
| 1 | +# SPDX-License-Identifier: AGPL-3.0-only |
| 2 | +# Copyright 2026 100monkeys.ai |
| 3 | + |
| 4 | +name: Publish npm |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + tags: |
| 9 | + - '*.*.*' |
| 10 | + workflow_dispatch: |
| 11 | + inputs: |
| 12 | + dry_run: |
| 13 | + description: 'Perform a dry run (no actual publishing)' |
| 14 | + required: false |
| 15 | + type: boolean |
| 16 | + default: false |
| 17 | + |
| 18 | +defaults: |
| 19 | + run: |
| 20 | + working-directory: zaru-mcp-server |
| 21 | + |
| 22 | +permissions: |
| 23 | + contents: write |
| 24 | + packages: write |
| 25 | + |
| 26 | +jobs: |
| 27 | + verify: |
| 28 | + name: Verify build |
| 29 | + runs-on: ubuntu-latest |
| 30 | + |
| 31 | + steps: |
| 32 | + - uses: actions/checkout@v4 |
| 33 | + |
| 34 | + - name: Set up Node.js |
| 35 | + uses: actions/setup-node@v4 |
| 36 | + with: |
| 37 | + node-version: '20' |
| 38 | + cache: 'npm' |
| 39 | + cache-dependency-path: zaru-mcp-server/package-lock.json |
| 40 | + |
| 41 | + - name: Install dependencies |
| 42 | + run: npm ci |
| 43 | + |
| 44 | + - name: Build |
| 45 | + run: npm run build |
| 46 | + |
| 47 | + publish: |
| 48 | + name: Publish @100monkeys-ai/zaru-mcp-server |
| 49 | + needs: verify |
| 50 | + runs-on: ubuntu-latest |
| 51 | + |
| 52 | + steps: |
| 53 | + - uses: actions/checkout@v4 |
| 54 | + |
| 55 | + - name: Set up Node.js |
| 56 | + uses: actions/setup-node@v4 |
| 57 | + with: |
| 58 | + node-version: '20' |
| 59 | + registry-url: 'https://npm.pkg.github.com' |
| 60 | + scope: '@100monkeys-ai' |
| 61 | + cache: 'npm' |
| 62 | + cache-dependency-path: zaru-mcp-server/package-lock.json |
| 63 | + |
| 64 | + - name: Install dependencies |
| 65 | + run: npm ci |
| 66 | + |
| 67 | + - name: Build |
| 68 | + run: npm run build |
| 69 | + |
| 70 | + - name: Publish package |
| 71 | + run: | |
| 72 | + if [ "${{ github.event.inputs.dry_run }}" == "true" ]; then |
| 73 | + echo "🔍 DRY RUN: Would publish @100monkeys-ai/zaru-mcp-server" |
| 74 | + npm publish --dry-run |
| 75 | + else |
| 76 | + echo "📦 Publishing @100monkeys-ai/zaru-mcp-server to GitHub Packages..." |
| 77 | + npm publish |
| 78 | + fi |
| 79 | + env: |
| 80 | + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 81 | + |
| 82 | + release: |
| 83 | + name: Create GitHub Release |
| 84 | + needs: publish |
| 85 | + if: github.event_name == 'push' |
| 86 | + runs-on: ubuntu-latest |
| 87 | + |
| 88 | + steps: |
| 89 | + - uses: actions/checkout@v4 |
| 90 | + |
| 91 | + - name: Get version |
| 92 | + id: version |
| 93 | + run: | |
| 94 | + VERSION="${GITHUB_REF#refs/tags/}" |
| 95 | + echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT |
| 96 | + if [[ "${VERSION}" == *"-"* ]]; then |
| 97 | + echo "IS_PRERELEASE=true" >> $GITHUB_OUTPUT |
| 98 | + else |
| 99 | + echo "IS_PRERELEASE=false" >> $GITHUB_OUTPUT |
| 100 | + fi |
| 101 | + working-directory: . |
| 102 | + |
| 103 | + - name: Create Release |
| 104 | + uses: softprops/action-gh-release@v2 |
| 105 | + with: |
| 106 | + tag_name: ${{ steps.version.outputs.VERSION }} |
| 107 | + name: "@100monkeys-ai/zaru-mcp-server ${{ steps.version.outputs.VERSION }}" |
| 108 | + draft: false |
| 109 | + prerelease: ${{ steps.version.outputs.IS_PRERELEASE == 'true' }} |
| 110 | + generate_release_notes: true |
| 111 | + env: |
| 112 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments