Skip to content

combine ofb with wiseflow #19

combine ofb with wiseflow

combine ofb with wiseflow #19

Workflow file for this run

name: Auto Release
on:
pull_request_target:
types: [closed]
branches: [master]
workflow_dispatch:
inputs:
bump_type:
description: 'Version bump type'
required: false
default: 'patch'
type: choice
options:
- patch
- minor
- major
permissions:
contents: write
# 防止多个 PR 同时 merge 时并发触发重复 release
concurrency:
group: release
cancel-in-progress: false
jobs:
release:
# CI 已在 PR 期间验证过,此处直接做版本 bump + 打包发布
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.RELEASE_TOKEN || secrets.GITHUB_TOKEN }}
- name: Determine bump type from PR labels
id: bump
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "type=${{ inputs.bump_type }}" >> "$GITHUB_OUTPUT"
else
LABELS='${{ toJSON(github.event.pull_request.labels.*.name) }}'
if echo "$LABELS" | grep -q '"major"'; then
echo "type=major" >> "$GITHUB_OUTPUT"
elif echo "$LABELS" | grep -q '"minor"'; then
echo "type=minor" >> "$GITHUB_OUTPUT"
else
echo "type=patch" >> "$GITHUB_OUTPUT"
fi
fi
- name: Calculate new version
id: version
run: |
CURRENT=$(cat version | tr -d '[:space:]')
NUM=${CURRENT#v}
IFS='.' read -r MAJOR MINOR PATCH <<< "$NUM"
MAJOR=${MAJOR:-0}
MINOR=${MINOR:-0}
PATCH=${PATCH:-0}
BUMP="${{ steps.bump.outputs.type }}"
if [ "$BUMP" = "major" ]; then
MAJOR=$((MAJOR + 1))
MINOR=0
PATCH=0
elif [ "$BUMP" = "minor" ]; then
MINOR=$((MINOR + 1))
PATCH=0
else
PATCH=$((PATCH + 1))
# Auto-carry: patch 累积到 10 时自动晋升 minor
if [ "$PATCH" -ge 10 ]; then
MINOR=$((MINOR + 1))
PATCH=0
fi
fi
NEW_VERSION="v${MAJOR}.${MINOR}.${PATCH}"
echo "new=$NEW_VERSION" >> "$GITHUB_OUTPUT"
echo "New version: $NEW_VERSION"
- name: Update version file
run: echo "${{ steps.version.outputs.new }}" > version
- name: Commit and tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add version
git commit -m "chore: bump version to ${{ steps.version.outputs.new }} [skip ci]"
git tag "${{ steps.version.outputs.new }}"
git push origin master --tags
- name: Read pinned openclaw version
id: pin
run: |
source openclaw.version
echo "commit=$OPENCLAW_COMMIT" >> "$GITHUB_OUTPUT"
echo "version=$OPENCLAW_VERSION" >> "$GITHUB_OUTPUT"
- name: Clone openclaw at pinned commit
run: |
git init openclaw
git -C openclaw remote add origin https://github.com/openclaw/openclaw.git
git -C openclaw fetch --depth=1 origin ${{ steps.pin.outputs.commit }}
git -C openclaw checkout FETCH_HEAD
- name: Clone openclaw_for_business
run: git clone --depth=1 https://github.com/TeamWiseFlow/openclaw_for_business.git openclaw_for_business
- name: Set up release directory structure
run: |
cp -r wiseflow openclaw_for_business/addons/wiseflow
cp -r openclaw openclaw_for_business/openclaw
- name: Package release
run: |
# 保留 openclaw/.git:apply-addons.sh 中 git apply --3way 依赖 git 仓库上下文
# 仅删除其他 .git 目录(wiseflow 本身、openclaw_for_business 等)
find openclaw_for_business -type d -name ".git" \
! -path "*/openclaw/.git" \
-exec rm -rf {} + 2>/dev/null || true
zip -r "wiseflow-${{ steps.version.outputs.new }}.zip" openclaw_for_business
- name: Create GitHub Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "${{ steps.version.outputs.new }}" \
"wiseflow-${{ steps.version.outputs.new }}.zip" \
--title "${{ steps.version.outputs.new }}" \
--generate-notes