File tree Expand file tree Collapse file tree 1 file changed +18
-9
lines changed Expand file tree Collapse file tree 1 file changed +18
-9
lines changed Original file line number Diff line number Diff line change 99
99
fs.writeFileSync('package.json', JSON.stringify(package, null, 2) + '\n');
100
100
"
101
101
102
- - name : Commit version update
103
- if : github.event_name == 'workflow_dispatch'
104
- run : |
105
- git config user.name 'github-actions[bot]'
106
- git config user.email 'github-actions[bot]@users.noreply.github.com'
107
- git add package.json
108
- git commit -m "chore: update package.json version to ${{ steps.new_version.outputs.version }}"
109
- git push
110
-
111
102
- name : Get Package Version
112
103
id : package_version
113
104
run : |
@@ -126,6 +117,24 @@ jobs:
126
117
fi
127
118
echo "version=${VERSION}" >> $GITHUB_OUTPUT
128
119
120
+ - name : Update package.json with version
121
+ run : |
122
+ # Use node to update package.json to preserve formatting
123
+ node -e "
124
+ const fs = require('fs');
125
+ const package = JSON.parse(fs.readFileSync('package.json'));
126
+ package.version = '${{ steps.package_version.outputs.version }}';
127
+ fs.writeFileSync('package.json', JSON.stringify(package, null, 2) + '\n');
128
+ "
129
+
130
+ - name : Commit version update
131
+ run : |
132
+ git config user.name 'github-actions[bot]'
133
+ git config user.email 'github-actions[bot]@users.noreply.github.com'
134
+ git add package.json
135
+ git commit -m "chore: update package.json version to ${{ steps.package_version.outputs.version }}"
136
+ git push
137
+
129
138
- name : Create Release
130
139
env :
131
140
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
You can’t perform that action at this time.
0 commit comments