Skip to content

Commit 163ab19

Browse files
committed
chore(release): update release workflows for version management
- Removed the manual version bump step from create-release.yml, replacing it with automated messaging about stable releases and version bumps. - Enhanced release-stable.yml to capture the released version and determine if a new release was published, followed by bumping the main branch to the next minor version after a successful release.
1 parent ed69e81 commit 163ab19

File tree

2 files changed

+79
-15
lines changed

2 files changed

+79
-15
lines changed

.github/workflows/create-release.yml

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,6 @@ jobs:
3131
git checkout -b "$BRANCH"
3232
git push origin "$BRANCH"
3333
echo "✅ Created $BRANCH from main"
34-
35-
- name: Bump main to next minor
36-
run: |
37-
# Calculate next minor version
38-
IFS='.' read -r major minor <<< "${{ inputs.version }}"
39-
NEXT_MINOR="$major.$((minor + 1))"
40-
41-
# Switch to main and create empty commit
42-
git checkout main
43-
git pull origin main
44-
git commit --allow-empty -m "feat: begin v${NEXT_MINOR} development"
45-
git push origin main
46-
47-
echo "✅ Bumped main to v${NEXT_MINOR}.0-next.x"
34+
echo ""
35+
echo "The stable release will be triggered automatically when changes are pushed to this branch."
36+
echo "After the stable release, the main branch will automatically bump to the next minor version."

.github/workflows/release-stable.yml

Lines changed: 76 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ jobs:
2525
release:
2626
needs: test
2727
runs-on: ubuntu-latest
28+
outputs:
29+
version: ${{ steps.get-version.outputs.version }}
30+
released: ${{ steps.semantic-release.outputs.new-release-published }}
2831
steps:
2932
- uses: actions/checkout@v4
3033
with:
@@ -50,8 +53,80 @@ jobs:
5053
echo "Ref name: ${{ github.ref_name }}"
5154
5255
- name: Release to latest channel
56+
id: semantic-release
5357
env:
5458
GITHUB_TOKEN: ${{ secrets.SUPERDOC_PAT }}
5559
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
5660
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
57-
run: npx semantic-release
61+
run: |
62+
# Run semantic-release and capture output
63+
npx semantic-release 2>&1 | tee release.log
64+
65+
# Check if a new release was published
66+
if grep -q "Published release" release.log; then
67+
echo "new-release-published=true" >> $GITHUB_OUTPUT
68+
else
69+
echo "new-release-published=false" >> $GITHUB_OUTPUT
70+
fi
71+
72+
- name: Get released version
73+
id: get-version
74+
if: steps.semantic-release.outputs.new-release-published == 'true'
75+
run: |
76+
# Extract version from the latest git tag
77+
VERSION=$(git describe --tags --abbrev=0 | sed 's/^v//')
78+
echo "version=$VERSION" >> $GITHUB_OUTPUT
79+
echo "Released version: $VERSION"
80+
81+
bump-next-version:
82+
needs: release
83+
if: needs.release.outputs.released == 'true'
84+
runs-on: ubuntu-latest
85+
steps:
86+
- uses: actions/checkout@v4
87+
with:
88+
token: ${{ secrets.SUPERDOC_PAT }}
89+
fetch-depth: 0
90+
ref: main
91+
92+
- uses: actions/setup-node@v4
93+
with:
94+
node-version: 22
95+
cache: npm
96+
97+
- name: Setup Git
98+
run: |
99+
git config --global user.name "github-actions[bot]"
100+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
101+
102+
- name: Install dependencies
103+
run: npm ci
104+
105+
- name: Bump to next minor version
106+
run: |
107+
# Parse the released version
108+
VERSION="${{ needs.release.outputs.version }}"
109+
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION"
110+
111+
# Calculate next minor version
112+
NEXT_MAJOR=$MAJOR
113+
NEXT_MINOR=$((MINOR + 1))
114+
NEXT_VERSION="${NEXT_MAJOR}.${NEXT_MINOR}.0-next.0"
115+
116+
echo "Current stable version: $VERSION"
117+
echo "Next development version: $NEXT_VERSION"
118+
119+
# Update package.json
120+
cd packages/superdoc
121+
npm version "$NEXT_VERSION" --no-git-tag-version
122+
123+
# Commit the change
124+
git add package.json
125+
git commit -m "chore: bump to v${NEXT_VERSION} [skip ci]
126+
127+
Begin development for v${NEXT_MAJOR}.${NEXT_MINOR}.0 after stable release v${VERSION}"
128+
129+
# Push to main
130+
git push origin main
131+
132+
echo "✅ Successfully bumped main branch to v${NEXT_VERSION}"

0 commit comments

Comments
 (0)