@@ -191,24 +191,28 @@ jobs:
191
191
name : Create tag
192
192
runs-on : self-hosted
193
193
steps :
194
- - name : Set Dist Version
194
+ - name : Determine new tag
195
+ id : tag
195
196
run : |
196
- BUILD_NUMBER="${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}"
197
- echo "${BUILD_NUMBER}"
198
- VERSION=$(echo $last_tag | awk -F. '{printf "v%d.%d.%d", $1, $2+1, 0}')
199
- echo "DIST_VERSION=${VERSION}" >> $GITHUB_ENV
197
+ last_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
198
+ echo "Last tag: $last_tag"
200
199
201
- - name : Create Tag
202
- uses : actions/github-script@v6
200
+ new_tag=$(echo $last_tag | awk -F. '{printf "v%d.%d.%d", $1, $2+1, 0}')
201
+ echo "New tag: $new_tag"
202
+
203
+ echo "TAG_NAME=$new_tag" >> $GITHUB_ENV
204
+
205
+ - name : Create tag
206
+ uses : actions/github-script@v5
203
207
with :
204
208
script : |
205
- const {DIST_VERSION} = process.env
206
209
github.rest.git.createRef({
207
- owner: context.repo.owner,
208
- repo: context.repo.repo,
209
- ref: `refs/tags/${DIST_VERSION}`,
210
- sha: context.sha
211
- })
210
+ owner: context.repo.owner,
211
+ repo: context.repo.repo,
212
+ ref: `refs/tags/${{ env.TAG_NAME }}`,
213
+ sha: context.sha
214
+ });
215
+
212
216
213
217
214
218
0 commit comments