Skip to content

Commit 12be48d

Browse files
committed
feat(workflow): add GitHub Actions workflow for publishing @flowiseai/agentflow
- Introduced a new workflow to handle version bumps and publishing of the @flowiseai/agentflow package. - Supports various version bump types (prerelease, patch, minor, major, custom) and allows for custom version input. - Includes a dry-run step to validate the version and simulate the publish process before actual deployment. - Configured to use pnpm for dependency management and publishing tasks.
1 parent d8da27c commit 12be48d

1 file changed

Lines changed: 121 additions & 0 deletions

File tree

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
name: Publish @flowiseai/agentflow
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
bump:
6+
description: 'Version bump type'
7+
required: true
8+
type: choice
9+
default: 'prerelease'
10+
options:
11+
- prerelease
12+
- patch
13+
- minor
14+
- major
15+
- custom
16+
custom_version:
17+
description: 'Custom version (only used when bump is "custom", e.g. 1.0.0-beta.1)'
18+
required: false
19+
type: string
20+
tag:
21+
description: 'npm dist-tag'
22+
required: false
23+
type: choice
24+
default: 'dev'
25+
options:
26+
- dev
27+
- latest
28+
29+
jobs:
30+
dry-run:
31+
runs-on: ubuntu-latest
32+
permissions:
33+
contents: read
34+
outputs:
35+
version: ${{ steps.resolve-version.outputs.version }}
36+
steps:
37+
- uses: actions/checkout@v4
38+
39+
- uses: pnpm/action-setup@v2
40+
41+
- uses: actions/setup-node@v4
42+
with:
43+
node-version: '18.15.0'
44+
registry-url: 'https://registry.npmjs.org'
45+
46+
- name: Validate custom version
47+
if: inputs.bump == 'custom'
48+
run: |
49+
if [ -z "${{ inputs.custom_version }}" ]; then
50+
echo "::error::custom_version is required when bump is 'custom'"
51+
exit 1
52+
fi
53+
npx semver "${{ inputs.custom_version }}" || (echo "::error::Invalid semver: ${{ inputs.custom_version }}" && exit 1)
54+
55+
- name: Install dependencies
56+
run: pnpm install --frozen-lockfile
57+
env:
58+
PUPPETEER_SKIP_DOWNLOAD: 'true'
59+
60+
- name: Set version
61+
run: |
62+
if [ "${{ inputs.bump }}" = "custom" ]; then
63+
pnpm --filter @flowiseai/agentflow exec npm version "${{ inputs.custom_version }}" --no-git-tag-version
64+
else
65+
pnpm --filter @flowiseai/agentflow exec npm version "${{ inputs.bump }}" --preid dev --no-git-tag-version
66+
fi
67+
68+
- name: Resolve version
69+
id: resolve-version
70+
run: |
71+
VERSION=$(node -p "require('./packages/agentflow/package.json').version")
72+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
73+
echo "## Version to publish: \`$VERSION\`" >> "$GITHUB_STEP_SUMMARY"
74+
echo "## Tag: \`${{ inputs.tag }}\`" >> "$GITHUB_STEP_SUMMARY"
75+
76+
- name: Package contents
77+
run: pnpm --filter @flowiseai/agentflow exec npm pack --dry-run
78+
79+
- name: Dry run publish
80+
run: pnpm --filter @flowiseai/agentflow publish --no-git-checks --dry-run --tag ${{ inputs.tag }}
81+
env:
82+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
83+
84+
publish:
85+
needs: dry-run
86+
runs-on: ubuntu-latest
87+
environment: npm-publish
88+
permissions:
89+
contents: read
90+
steps:
91+
- uses: actions/checkout@v4
92+
93+
- uses: pnpm/action-setup@v2
94+
95+
- uses: actions/setup-node@v4
96+
with:
97+
node-version: '18.15.0'
98+
registry-url: 'https://registry.npmjs.org'
99+
100+
- name: Install dependencies
101+
run: pnpm install --frozen-lockfile
102+
env:
103+
PUPPETEER_SKIP_DOWNLOAD: 'true'
104+
105+
- name: Set version
106+
run: |
107+
if [ "${{ inputs.bump }}" = "custom" ]; then
108+
pnpm --filter @flowiseai/agentflow exec npm version "${{ inputs.custom_version }}" --no-git-tag-version
109+
else
110+
pnpm --filter @flowiseai/agentflow exec npm version "${{ inputs.bump }}" --preid dev --no-git-tag-version
111+
fi
112+
113+
- name: Log version
114+
run: |
115+
echo "Publishing version: ${{ needs.dry-run.outputs.version }}"
116+
echo "Tag: ${{ inputs.tag }}"
117+
118+
- name: Publish
119+
run: pnpm --filter @flowiseai/agentflow publish --no-git-checks --tag ${{ inputs.tag }}
120+
env:
121+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)