33
33
jobs :
34
34
version :
35
35
runs-on : ubuntu-latest
36
- outputs :
37
- HEAD : ${{ steps.version.outputs.HEAD }}
38
- RELEASE_VERSION : ${{ steps.version.outputs.RELEASE_VERSION }}
39
- PLAIN_VERSION : ${{ steps.version.outputs.PLAIN_VERSION }}
40
- NEXT_VERSION : ${{ steps.version.outputs.NEXT_VERSION }}
41
36
steps :
42
37
- uses : actions/checkout@v3
43
38
51
46
- name : Set release version
52
47
id : version
53
48
run : |
49
+ BRANCH="moditect-${{ github.event.inputs.version }}"
54
50
RELEASE_VERSION=${{ github.event.inputs.version }}
55
51
NEXT_VERSION=${{ github.event.inputs.next }}
56
52
PLAIN_VERSION=`echo ${RELEASE_VERSION} | awk 'match($0, /^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)/) { print substr($0, RSTART, RLENGTH); }'`
@@ -59,16 +55,16 @@ jobs:
59
55
then
60
56
NEXT_VERSION=$COMPUTED_NEXT_VERSION
61
57
fi
58
+ git checkout -b $BRANCH
62
59
./mvnw -ntp -B versions:set versions:commit -DnewVersion=$RELEASE_VERSION -pl :moditect-parent
63
60
git config --global user.email "[email protected] "
64
61
git config --global user.name "moditect-release-bot"
65
62
git commit -a -m "Releasing version $VERSION"
66
- git push origin HEAD:main
67
- HEAD=$(git rev-parse HEAD)
68
- echo "HEAD=$HEAD" >> $GITHUB_OUTPUT
69
- echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_OUTPUT
70
- echo "NEXT_VERSION=$NEXT_VERSION" >> $GITHUB_OUTPUT
71
- echo "PLAIN_VERSION=$PLAIN_VERSION" >> $GITHUB_OUTPUT
63
+ git push origin $BRANCH
64
+ echo "BRANCH=$BRANCH" >> $GITHUB_ENV
65
+ echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
66
+ echo "NEXT_VERSION=$NEXT_VERSION" >> $GITHUB_ENV
67
+ echo "PLAIN_VERSION=$PLAIN_VERSION" >> $GITHUB_ENV
72
68
73
69
release :
74
70
needs : [ version ]
77
73
- name : Checkout
78
74
uses : actions/checkout@v3
79
75
with :
80
- ref : ${{ needs.version.outputs.HEAD }}
76
+ ref : ${{ env.BRANCH }}
81
77
fetch-depth : 0
82
78
83
79
- name : Setup Java
@@ -106,6 +102,7 @@ jobs:
106
102
- name : Release to GitHub
107
103
env :
108
104
JRELEASER_GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
105
+ JRELEASER_BRANCH : ${{ env.BRANCH }}
109
106
run : |
110
107
./mvnw -B --file pom.xml -pl :moditect-parent -Pjreleaser jreleaser:release
111
108
@@ -119,11 +116,9 @@ jobs:
119
116
parent/target/jreleaser/output.properties
120
117
121
118
- name : Set next version
122
- env :
123
- NEXT_VERSION : ${{ needs.version.outputs.NEXT_VERSION }}
124
119
run : |
125
- ./mvnw -ntp -B versions:set versions:commit -DnewVersion=$NEXT_VERSION -pl :moditect-parent
120
+ ./mvnw -ntp -B versions:set versions:commit -DnewVersion=${{ env. NEXT_VERSION }} -pl :moditect-parent
126
121
git config --global user.email "[email protected] "
127
122
git config --global user.name "moditect-release-bot"
128
- git commit -a -m "Next version $NEXT_VERSION"
129
- git push origin HEAD:main
123
+ git commit -a -m "Next version ${{ env. NEXT_VERSION }} "
124
+ git push origin ${{ env.BRANCH }}
0 commit comments