1- name : Release PR
2-
1+ name : Release
32on :
4- workflow_dispatch :
5- inputs :
6- bump_type :
7- description : ' Bump (patch, minor, major)'
8- required : true
9- default : ' patch'
10- type : choice
11- options :
12- - patch
13- - minor
14- - major
15-
16- permissions :
17- contents : write
18- pull-requests : write
3+ workflow_dispatch :
4+ inputs :
5+ bump :
6+ description : ' Version Bump'
7+ type : choice
8+ options : [ patch, minor, major ]
9+ default : ' patch'
1910
2011jobs :
21- release :
22- runs-on : ubuntu-latest
23- steps :
24- - name : Checkout code
25- uses : actions/checkout@v6
26- with :
27- persist-credentials : false
12+ release :
13+ runs-on : ubuntu-latest
14+ steps :
15+ - name : Checkout
16+ uses : actions/checkout@v6
17+ with :
18+ token : ${{ secrets.PAT }}
19+
20+ - name : Run Lite Release
21+ 22+ with :
23+ token : ${{ secrets.PAT }}
24+ bump_type : ${{ github.event.inputs.bump }}
25+
26+ commit_release : ' Release {VERSION}'
27+ commit_release_update_files : ' README.md, **/*.gradle.kts, **/ExamplePlugin.java, **/fabric.mod.json'
2828
29- - name : Calculate New Version
30- id : vars
31- run : |
32- # Parse versions from JSON
33- OLD_RELEASE=$(jq -r '.versionRelease' .github/release/version.json)
34- VERSION_SNAPSHOT=$(jq -r '.versionSnapshot' .github/release/version.json)
35-
36- # Split into version parts
37- IFS='.' read -ra ADDR <<< "$OLD_RELEASE"
38- MAJOR=${ADDR[0]}
39- MINOR=${ADDR[1]}
40- PATCH=${ADDR[2]}
41-
42- # Update release version
43- if [ "${{ github.event.inputs.bump_type }}" == "major" ]; then
44- MAJOR=$((MAJOR + 1)); MINOR=0; PATCH=0
45- elif [ "${{ github.event.inputs.bump_type }}" == "minor" ]; then
46- MINOR=$((MINOR + 1)); PATCH=0
47- else
48- PATCH=$((PATCH + 1))
49- fi
50-
51- NEW_RELEASE="$MAJOR.$MINOR.$PATCH"
52-
53- echo "OLD_RELEASE=$OLD_RELEASE" >> $GITHUB_OUTPUT
54- echo "NEW_RELEASE=$NEW_RELEASE" >> $GITHUB_OUTPUT
55- echo "VERSION_SNAPSHOT=$VERSION_SNAPSHOT" >> $GITHUB_OUTPUT
29+ commit_snapshot : ' Snapshot {VERSION}'
30+ commit_snapshot_update_files : ' buildSrc/src/main/kotlin/litecommands-publish.gradle.kts'
5631
57- - name : Update Files
58- run : |
59- NEW_RELEASE="${{ steps.vars.outputs.NEW_RELEASE }}"
60- OLD_RELEASE="${{ steps.vars.outputs.OLD_RELEASE }}"
61- VERSION_SNAPSHOT="${{ steps.vars.outputs.VERSION_SNAPSHOT }}"
62-
63- # Global update all files (old release -> new release)
64- grep -rl "$OLD_RELEASE" . --exclude-dir=.git --exclude=*.yml | xargs sed -i "s/$OLD_RELEASE/$NEW_RELEASE/g"
65-
66- # Update .github/release/version.json
67- jq ".versionRelease = \"$NEW_RELEASE\"" .github/release/version.json > temp.json && mv temp.json .github/release/version.json
68-
69- # Update gradle.kts (snapshot -> release)
70- sed -i "s/$VERSION_SNAPSHOT/$NEW_RELEASE/g" buildSrc/src/main/kotlin/litecommands-publish.gradle.kts
32+ git_user_name : ' Rollczi'
33+ git_user_email :
' [email protected] ' 7134
72- - name : Create Pull Request
73- uses : peter-evans/create-pull-request@v8
74- with :
75- token : ${{ secrets.PAT }}
76- commit-message : " Release ${{ steps.vars.outputs.NEW_RELEASE }}"
77- branch : " release/${{ steps.vars.outputs.NEW_RELEASE }}"
78- title : " Release ${{ steps.vars.outputs.NEW_RELEASE }}"
79- body : " Automatic PR preparing version ${{ steps.vars.outputs.NEW_RELEASE }}. After the merge, the version will be bumped to the next Snapshot."
35+ github_release_title : ' LiteCommands v{VERSION}'
36+ github_release_template : ' .github/release/template.md'
0 commit comments