|
1 | | -name: release-node |
| 1 | +name: Release & Publish |
2 | 2 |
|
3 | 3 | on: |
4 | | - workflow_dispatch: |
5 | | - inputs: |
6 | | - version_tag: |
7 | | - description: "Node tag (npm-vX.Y.Z)" |
8 | | - required: true |
9 | | - type: string |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "cli-v*" |
| 7 | + - "sdk-v*" |
10 | 8 |
|
11 | 9 | permissions: |
12 | | - contents: write |
13 | | - id-token: write |
| 10 | + contents: write # Create GitHub Release |
| 11 | + id-token: write # npm trusted publishing (OIDC — no token needed) |
| 12 | + |
| 13 | +defaults: |
| 14 | + run: |
| 15 | + working-directory: . |
14 | 16 |
|
15 | 17 | jobs: |
16 | | - publish: |
| 18 | + release-cli: |
| 19 | + if: startsWith(github.ref_name, 'cli-v') |
17 | 20 | runs-on: ubuntu-latest |
18 | 21 | steps: |
19 | 22 | - name: Checkout |
20 | 23 | uses: actions/checkout@v4 |
21 | | - |
22 | | - - name: Setup Python |
23 | | - uses: actions/setup-python@v5 |
24 | 24 | with: |
25 | | - python-version: "3.12" |
| 25 | + fetch-depth: 0 |
26 | 26 |
|
27 | | - - name: Install python package |
| 27 | + - name: Extract version |
| 28 | + id: meta |
28 | 29 | run: | |
29 | | - python -m pip install --upgrade pip |
30 | | - python -m pip install -e . |
| 30 | + VERSION="${GITHUB_REF_NAME#cli-v}" |
| 31 | + echo "version=$VERSION" >> "$GITHUB_OUTPUT" |
| 32 | + echo "📦 CLI v$VERSION" |
31 | 33 |
|
32 | | - - name: Validate operation-id mappings |
33 | | - run: | |
34 | | - python3 scripts/check_operation_id_mappings.py |
| 34 | + - name: Setup Node.js |
| 35 | + uses: actions/setup-node@v4 |
| 36 | + with: |
| 37 | + node-version: "22" |
| 38 | + registry-url: "https://registry.npmjs.org" |
| 39 | + |
| 40 | + - name: Install dependencies |
| 41 | + run: npm ci |
| 42 | + |
| 43 | + - name: Build SDK (dependency) |
| 44 | + run: npm run build --workspace=packages/sdk |
| 45 | + |
| 46 | + - name: Build CLI |
| 47 | + run: npm run build --workspace=packages/cli |
| 48 | + |
| 49 | + - name: Run tests |
| 50 | + run: npm test --workspace=packages/cli |
| 51 | + |
| 52 | + - name: Set package version |
| 53 | + working-directory: packages/cli |
| 54 | + run: npm version "${{ steps.meta.outputs.version }}" --no-git-tag-version |
| 55 | + |
| 56 | + - name: Publish to npm (trusted publishing) |
| 57 | + working-directory: packages/cli |
| 58 | + run: npm publish --access public --provenance |
| 59 | + |
| 60 | + - name: Create GitHub Release |
| 61 | + uses: softprops/action-gh-release@v2 |
| 62 | + with: |
| 63 | + tag_name: ${{ github.ref_name }} |
| 64 | + name: "CLI v${{ steps.meta.outputs.version }}" |
| 65 | + generate_release_notes: true |
| 66 | + body: | |
| 67 | + ## 📦 @pixelml/agenticflow-cli@${{ steps.meta.outputs.version }} |
| 68 | +
|
| 69 | + ```bash |
| 70 | + npm install -g @pixelml/agenticflow-cli@${{ steps.meta.outputs.version }} |
| 71 | + ``` |
| 72 | +
|
| 73 | + [View on npm](https://www.npmjs.com/package/@pixelml/agenticflow-cli/v/${{ steps.meta.outputs.version }}) |
| 74 | +
|
| 75 | + --- |
35 | 76 |
|
36 | | - - name: Run CLI smoke gate |
| 77 | + - name: Summary |
37 | 78 | run: | |
38 | | - bash scripts/release_readiness.sh --skip-tests --skip-node |
| 79 | + echo "## ✅ CLI v${{ steps.meta.outputs.version }} released" >> "$GITHUB_STEP_SUMMARY" |
| 80 | + echo "- Published to [npm](https://www.npmjs.com/package/@pixelml/agenticflow-cli/v/${{ steps.meta.outputs.version }})" >> "$GITHUB_STEP_SUMMARY" |
| 81 | + echo "- GitHub Release created with auto-generated notes" >> "$GITHUB_STEP_SUMMARY" |
| 82 | + echo "- 🔒 Trusted publishing (OIDC, no token)" >> "$GITHUB_STEP_SUMMARY" |
39 | 83 |
|
40 | | - - name: Run live 71-op release gate |
41 | | - if: ${{ secrets.AGENTICFLOW_PUBLIC_API_KEY != '' }} |
42 | | - env: |
43 | | - AGENTICFLOW_PUBLIC_API_KEY: ${{ secrets.AGENTICFLOW_PUBLIC_API_KEY }} |
44 | | - NEXT_PUBLIC_BASE_API_URL: ${{ secrets.AGENTICFLOW_BASE_URL }} |
| 84 | + release-sdk: |
| 85 | + if: startsWith(github.ref_name, 'sdk-v') |
| 86 | + runs-on: ubuntu-latest |
| 87 | + steps: |
| 88 | + - name: Checkout |
| 89 | + uses: actions/checkout@v4 |
| 90 | + with: |
| 91 | + fetch-depth: 0 |
| 92 | + |
| 93 | + - name: Extract version |
| 94 | + id: meta |
45 | 95 | run: | |
46 | | - bash scripts/release_readiness.sh --skip-tests --skip-node --live-ops-gate |
| 96 | + VERSION="${GITHUB_REF_NAME#sdk-v}" |
| 97 | + echo "version=$VERSION" >> "$GITHUB_OUTPUT" |
| 98 | + echo "📦 SDK v$VERSION" |
47 | 99 |
|
48 | | - - name: Setup Node |
| 100 | + - name: Setup Node.js |
49 | 101 | uses: actions/setup-node@v4 |
50 | 102 | with: |
51 | 103 | node-version: "22" |
52 | 104 | registry-url: "https://registry.npmjs.org" |
53 | 105 |
|
54 | | - - name: Validate tag and sync package version |
55 | | - id: meta |
56 | | - shell: bash |
57 | | - run: | |
58 | | - set -euo pipefail |
59 | | - if [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]]; then |
60 | | - TAG="${{ inputs.version_tag }}" |
61 | | - else |
62 | | - TAG="${GITHUB_REF_NAME}" |
63 | | - fi |
64 | | - if [[ ! "${TAG}" =~ ^npm-v([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then |
65 | | - echo "Expected npm-vX.Y.Z, got: ${TAG}" >&2 |
66 | | - exit 1 |
67 | | - fi |
68 | | - VERSION="${BASH_REMATCH[1]}" |
69 | | - npm version "${VERSION}" --no-git-tag-version |
70 | | - echo "tag=${TAG}" >> "$GITHUB_OUTPUT" |
71 | | - echo "version=${VERSION}" >> "$GITHUB_OUTPUT" |
72 | | -
|
73 | | - - name: Ensure npm supports trusted publishing |
74 | | - run: | |
75 | | - npm i -g npm@11.5.1 |
76 | | - npm --version |
| 106 | + - name: Install dependencies |
| 107 | + run: npm ci |
77 | 108 |
|
78 | | - - name: Pack npm artifact |
79 | | - run: | |
80 | | - npm pack |
| 109 | + - name: Build SDK |
| 110 | + run: npm run build --workspace=packages/sdk |
| 111 | + |
| 112 | + - name: Run tests |
| 113 | + run: npm test --workspace=packages/sdk |
| 114 | + |
| 115 | + - name: Set package version |
| 116 | + working-directory: packages/sdk |
| 117 | + run: npm version "${{ steps.meta.outputs.version }}" --no-git-tag-version |
| 118 | + |
| 119 | + - name: Publish to npm (trusted publishing) |
| 120 | + working-directory: packages/sdk |
| 121 | + run: npm publish --access public --provenance |
| 122 | + |
| 123 | + - name: Create GitHub Release |
| 124 | + uses: softprops/action-gh-release@v2 |
| 125 | + with: |
| 126 | + tag_name: ${{ github.ref_name }} |
| 127 | + name: "SDK v${{ steps.meta.outputs.version }}" |
| 128 | + generate_release_notes: true |
| 129 | + body: | |
| 130 | + ## 📦 @pixelml/agenticflow-sdk@${{ steps.meta.outputs.version }} |
| 131 | +
|
| 132 | + ```bash |
| 133 | + npm install @pixelml/agenticflow-sdk@${{ steps.meta.outputs.version }} |
| 134 | + ``` |
| 135 | +
|
| 136 | + [View on npm](https://www.npmjs.com/package/@pixelml/agenticflow-sdk/v/${{ steps.meta.outputs.version }}) |
| 137 | +
|
| 138 | + --- |
81 | 139 |
|
82 | | - - name: Publish to npm (Trusted Publishing) |
| 140 | + - name: Summary |
83 | 141 | run: | |
84 | | - npm publish --access public |
| 142 | + echo "## ✅ SDK v${{ steps.meta.outputs.version }} released" >> "$GITHUB_STEP_SUMMARY" |
| 143 | + echo "- Published to [npm](https://www.npmjs.com/package/@pixelml/agenticflow-sdk/v/${{ steps.meta.outputs.version }})" >> "$GITHUB_STEP_SUMMARY" |
| 144 | + echo "- GitHub Release created with auto-generated notes" >> "$GITHUB_STEP_SUMMARY" |
| 145 | + echo "- 🔒 Trusted publishing (OIDC, no token)" >> "$GITHUB_STEP_SUMMARY" |
0 commit comments