Skip to content

Commit a24384a

Browse files
committed
chore: add version bump mechanism
1 parent fdea188 commit a24384a

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

.github/workflows/publish.yml

+14-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ jobs:
3636
- name: Export JSON from YAML
3737
run: js-yaml mcfunction.tmLanguage.yaml > mcfunction.tmLanguage.json
3838

39+
- id: version
40+
name: Version
41+
run: version=$(echo ${{ github.ref_name }} | sed 's/^v//') >> "$GITHUB_OUTPUT"
42+
3943
- name: Push JSON to repo for sublime (if not matched)
4044
if: github.ref == 'refs/heads/main'
4145
run: |
@@ -46,11 +50,20 @@ jobs:
4650
git push origin main
4751
continue-on-error: true
4852

53+
- name: Push version number to repo
54+
if: startsWith(github.ref, 'refs/tags/')
55+
run: |
56+
jq '.version = ${{ steps.version.outputs.version }}' package.json > package.json
57+
git config --global user.name "github-actions"
58+
git config --global user.email "[email protected]"
59+
git add mcfunction.tmLanguage.json
60+
git commit -m "🤖 Bump version"
61+
git push origin main
62+
4963
- id: package
5064
name: Package VSCode Ext
5165
run: |
5266
vsce package
53-
VERSION=$(echo ${{ github.ref_name }} | sed 's/^v//')
5467
echo "ext=syntax-mcfunction-$VERSION.vsix" >> "$GITHUB_OUTPUT"
5568
5669
- name: Archive production artifacts

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@
4343
"devDependencies": {
4444
"js-yaml": "^4.1.0"
4545
}
46-
}
46+
}

0 commit comments

Comments
 (0)