Skip to content

Commit b7327bd

Browse files
committed
Tag lua-language-server-addon branch (fix #57)
1 parent 22c11e7 commit b7327bd

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

.github/workflows/release.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,30 @@ jobs:
8686
TARGET_BRANCH: lua-language-server-addon
8787
run: |
8888
libraryPathFirstPart=`echo $LIBRARY_PATH | cut -d'/' -f1`
89+
8990
git config --global user.name 'GitHub Action'
9091
git config --global user.email '[email protected]'
91-
# git fetch
92+
93+
# Checkout the target branch, create it if it doesn't exist
9294
git checkout $TARGET_BRANCH 2>/dev/null || git checkout -b $TARGET_BRANCH
95+
96+
# Remove all files except .git and the library files
9397
rm -rf $(ls -A | grep -vE ".git$|^$libraryPathFirstPart$")
9498
mv $LIBRARY_PATH/* .
9599
rm -rf $libraryPathFirstPart
100+
101+
# Commit these changes
96102
git add -A
97103
git diff-index --quiet HEAD || git commit -am "🚀 Update ${{ fromJson(env.releaseJson).version }}"
98-
git push origin $TARGET_BRANCH # push to remote branch
99-
# From here on the workflow repo no longer contains the dist files, nor node_modules (removed when publishing branch)
104+
105+
# Increment the tag, based on the previous tag (v0001, v0002, ...)
106+
lastTag=$(git tag -l --sort=-v:refname | grep -E "^v[0-9]{4}$" | head -n 1)
107+
lastTagNumber=${lastTag:1}
108+
newTagNumber=$((lastTagNumber + 1))
109+
newTag="v$(printf "%04d" $newTagNumber)"
110+
git tag $newTag
111+
112+
# Push the changes (including the tag)
113+
git push origin $TARGET_BRANCH --follow-tags
114+
115+
# NOTE: From here on the workflow repo no longer contains the dist files, nor node_modules (removed when publishing branch)

0 commit comments

Comments
 (0)