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 :
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