Skip to content

Commit 8cedbec

Browse files
committed
fix: use stricter tag, use action for validation and rename to package-release
1 parent 21963c2 commit 8cedbec

File tree

1 file changed

+9
-19
lines changed

1 file changed

+9
-19
lines changed

.github/workflows/merge-release-tag.yml

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Merge Release Tag
33
on:
44
push:
55
tags:
6-
- 'mongosh@[0-9]+.[0-9]+.*'
6+
- 'mongosh@[0-9]+.[0-9]+.[0-9]+*'
77
workflow_dispatch:
88

99
permissions:
@@ -31,27 +31,17 @@ jobs:
3131
id: version-match
3232
with:
3333
text: ${{ github.ref }}
34-
regex: 'refs/tags/mongosh@([0-9]+\.[0-9]+\.*)'
34+
regex: 'refs/tags/mongosh@([0-9]+\.[0-9]+\.[0-9]+.*)'
3535

36-
- name: Validate release version
37-
shell: bash
38-
id: validate
39-
run: |
40-
if [[ -z "${{ steps.version-match.outputs.group1 }}" ]]; then
41-
echo "Error: Could not extract version from tag"
42-
exit 1
43-
fi
44-
45-
if git rev-parse "release/v${{ steps.version-match.outputs.group1 }}" >/dev/null 2>&1; then
46-
echo "Error: Branch release/v$RELEASE_TAG already exists"
47-
echo "If this version has already been released consider using a different one."
48-
exit 1
49-
fi
50-
echo "::set-output name=version::${{ steps.version-match.outputs.group1 }}"
36+
- uses: actions/github-script@v7
37+
if: steps.version-match.outputs.group1 == ''
38+
with:
39+
script: |
40+
core.setFailed('Could not extract version from tag: ${{ github.ref }}');
5141
5242
- name: Merge release tag into main
5343
run: |
54-
git checkout -b release/v${{ steps.validate.outputs.version }} ${{ github.ref }}
44+
git checkout -b package-release/v${{ steps.version-match.outputs.group1 }} ${{ github.ref }}
5545
git checkout main
56-
git merge release/v${{ steps.validate.outputs.version }}
46+
git merge package-release/v${{ steps.version-match.outputs.group1 }}
5747
git push origin main

0 commit comments

Comments
 (0)