Skip to content

Commit 76f4701

Browse files
Update Create-NewReleases.yml
1 parent b4932d5 commit 76f4701

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

.github/workflows/Create-NewReleases.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,30 @@
1-
name: Auto Tag and Release
1+
name: Auto Tag, Release on PR Merge
22
on:
3-
push:
3+
pull_request:
44
branches:
55
- 'main'
6+
types:
7+
- closed
8+
69
permissions:
710
contents: write
11+
812
jobs:
913
tag-and-release:
14+
if: github.event.pull_request.merged == true && github.head_ref == 'dev'
1015
runs-on: ubuntu-latest
1116
steps:
1217
- name: Checkout source code
1318
uses: actions/checkout@v4.0.0
1419
with:
1520
fetch-depth: 0
21+
ref: 'main' # Ensure we're tagging the main branch after the merge
22+
1623
- name: Configure Git
1724
run: |
1825
git config --local user.email "action@github.com"
1926
git config --local user.name "GitHub Action"
27+
2028
- name: Determine Next Version Tag
2129
id: nextver
2230
run: |
@@ -43,10 +51,12 @@ jobs:
4351
NEXT_TAG="v$MAJOR.$MINOR.$PATCH"
4452
echo "Next version tag: $NEXT_TAG"
4553
echo "tag=$NEXT_TAG" >> $GITHUB_OUTPUT
54+
4655
- name: Create and Push Tag
4756
run: |
4857
git tag ${{ steps.nextver.outputs.tag }}
4958
git push origin ${{ steps.nextver.outputs.tag }}
59+
5060
- name: Create Release with Automated Release Notes
5161
uses: softprops/action-gh-release@v0.1.15
5262
with:

0 commit comments

Comments
 (0)