11# @author Madhavan Sridharan
2- name : Prepare Version Tag
2+ name : Prepare new tag & changelog PR
33
4+ # runs on
5+ # * manually triggered
46on :
57 workflow_dispatch :
68 inputs :
1416 - minor
1517 - major
1618
19+ # global env vars, available in all jobs and steps
20+ env :
21+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
22+
1723jobs :
18- tag :
24+ new_tag_and_changelog :
1925 runs-on : ubuntu-latest
26+ permissions :
27+ contents : write
28+ pull-requests : write
2029
2130 steps :
2231 - name : Checkout repo
2332 uses : actions/checkout@v4
33+ with :
34+ token : ${{ secrets.GITHUB_TOKEN }}
2435
2536 - name : Set up Node.js
2637 uses : actions/setup-node@v4
@@ -32,10 +43,48 @@ jobs:
3243 git config user.name "GitHub Actions"
3344 git config user.email "[email protected] " 3445
35- - name : Create version bump branch
46+ - name : Bump the tag version
3647 id : create_branch
48+ # --no-git-tag-version ensures we control when tags are pushed
49+ # git fetch origin main
50+ # git checkout -b release/bump-tag-version origin/main
3751 run : |
38- git fetch origin main
39- git checkout -b release/bump-tag-version origin/main
4052 npm version ${{ github.event.inputs.release_type }} -m "chore(release): bump tag version to %s"
41- git push origin -u release/bump-tag-version --follow-tags
53+ # --follow-tags is not used when pushing the branch in the next step since we're using --no-git-tag-version here
54+
55+ # - name: Commit version bump
56+ # run: |
57+ # git add package.json
58+ # git commit -m "chore(release): bump tag version to $(jq -r .version package.json)" || echo "No changes to commit"
59+ # git push origin release/bump-tag-version
60+
61+ # Duplicate
62+ # - name: Configure Git credentials
63+ # run: |
64+ # git config --global url."https://github.com/".insteadOf "[email protected] :" 65+ # git config --global credential.helper store
66+
67+ # - name: Debug Git state
68+ # run: |
69+ # git remote -v
70+ # git branch
71+ # git config --list
72+
73+ - name : Generate changelog
74+ continue-on-error : true
75+ run : ./update_changelog.sh
76+
77+ - name : Create pull request
78+ uses : peter-evans/create-pull-request@v7
79+ env :
80+ GITHUB_TOKEN :
81+ with :
82+ token : ${{ secrets.GITHUB_TOKEN }}
83+ branch : " release/bump-tag-version"
84+ # branch-suffix: "short-commit-hash"
85+ base : " main"
86+ title : " chore(release): Bump tag version and update changelog"
87+ commit-message : " chore(release): Bump tag version and update changelog"
88+ body : |
89+ This pull request bumps the tag version to $(jq -r .version package.json) and updates changelog as part of the release process.
90+ Please review and merge.
0 commit comments