Skip to content

Commit 960e9c5

Browse files
authored
fix: cd error (#4)
1 parent d787859 commit 960e9c5

File tree

2 files changed

+49
-11
lines changed

2 files changed

+49
-11
lines changed

.github/workflows/publish.yml

Lines changed: 48 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ on:
2727
- "4"
2828
- "5"
2929

30+
# Add permission configuration
31+
permissions:
32+
contents: write
33+
3034
jobs:
3135
publish:
3236
runs-on: ubuntu-latest
@@ -47,17 +51,51 @@ jobs:
4751
- name: Build project
4852
run: npm run build
4953

54+
- name: Get current version
55+
id: get-current-version
56+
run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
57+
5058
- name: Version update (official version)
5159
if: ${{ github.event.inputs.release-type == 'patch' || github.event.inputs.release-type == 'minor' || github.event.inputs.release-type == 'major' }}
5260
run: npm version ${{ github.event.inputs.release-type }} --no-git-tag-version
5361

54-
- name: Version update (Beta version)
55-
if: ${{ github.event.inputs.release-type == 'beta' }}
56-
run: npm version prepatch --preid=beta --no-git-tag-version && npm version prerelease --preid=beta --no-git-tag-version --increment=${{ github.event.inputs.version-increment }}
62+
- name: Version update (Beta version - first time)
63+
if: ${{ github.event.inputs.release-type == 'beta' && !contains(steps.get-current-version.outputs.version, 'beta') }}
64+
run: |
65+
npm --no-git-tag-version version prerelease --preid=beta
66+
# If a specific increment number is needed, execute additional increments
67+
if [ "${{ github.event.inputs.version-increment }}" != "0" ]; then
68+
for i in $(seq 1 ${{ github.event.inputs.version-increment }}); do
69+
npm --no-git-tag-version version prerelease --preid=beta
70+
done
71+
fi
5772
58-
- name: Version update (Alpha version)
59-
if: ${{ github.event.inputs.release-type == 'alpha' }}
60-
run: npm version prepatch --preid=alpha --no-git-tag-version && npm version prerelease --preid=alpha --no-git-tag-version --increment=${{ github.event.inputs.version-increment }}
73+
- name: Version update (Beta version - increment)
74+
if: ${{ github.event.inputs.release-type == 'beta' && contains(steps.get-current-version.outputs.version, 'beta') }}
75+
run: |
76+
# For versions with existing beta tags, directly increment the pre-release version number
77+
for i in $(seq 1 $((${{ github.event.inputs.version-increment }} + 1))); do
78+
npm --no-git-tag-version version prerelease --preid=beta
79+
done
80+
81+
- name: Version update (Alpha version - first time)
82+
if: ${{ github.event.inputs.release-type == 'alpha' && !contains(steps.get-current-version.outputs.version, 'alpha') }}
83+
run: |
84+
npm --no-git-tag-version version prerelease --preid=alpha
85+
# If a specific increment number is needed, execute additional increments
86+
if [ "${{ github.event.inputs.version-increment }}" != "0" ]; then
87+
for i in $(seq 1 ${{ github.event.inputs.version-increment }}); do
88+
npm --no-git-tag-version version prerelease --preid=alpha
89+
done
90+
fi
91+
92+
- name: Version update (Alpha version - increment)
93+
if: ${{ github.event.inputs.release-type == 'alpha' && contains(steps.get-current-version.outputs.version, 'alpha') }}
94+
run: |
95+
# For versions with existing alpha tags, directly increment the pre-release version number
96+
for i in $(seq 1 $((${{ github.event.inputs.version-increment }} + 1))); do
97+
npm --no-git-tag-version version prerelease --preid=alpha
98+
done
6199
62100
- name: Publish to NPM
63101
run: npm publish
@@ -68,12 +106,12 @@ jobs:
68106
id: get-version
69107
run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
70108

71-
- name: Commit version changes
109+
- name: Commit version change
72110
run: |
73-
git config --local user.email "action@github.com"
74-
git config --local user.name "GitHub Action"
111+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
112+
git config --local user.name "github-actions[bot]"
75113
git add package.json
76-
git commit -m "chore: Release v${{ steps.get-version.outputs.version }}"
114+
git commit -m "chore: publish v${{ steps.get-version.outputs.version }}"
77115
git tag v${{ steps.get-version.outputs.version }}
78116
git push
79117
git push --tags

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mastergo/magic-mcp",
3-
"version": "0.0.3-beta",
3+
"version": "0.0.4-beta.1",
44
"description": "MasterGo MCP standalone service",
55
"main": "dist/index.js",
66
"bin": {

0 commit comments

Comments
 (0)