Skip to content

Commit dc892f1

Browse files
authored
Gh-3259: Improve release process (#3260)
* update release pipelines * simplify * release notes fix * remove comment * address comments
1 parent f4d3738 commit dc892f1

File tree

4 files changed

+116
-151
lines changed

4 files changed

+116
-151
lines changed

.github/release-notes.yml

-20
This file was deleted.

.github/release.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
changelog:
2+
categories:
3+
- title: Headliners
4+
labels:
5+
- headliner
6+
- title: New Features
7+
labels:
8+
- feature
9+
- title: Enhancements
10+
labels:
11+
- enhancement
12+
- title: Bugs Fixed
13+
labels:
14+
- bug
15+
- title: Documentation
16+
labels:
17+
- documentation
18+
- title: Automation
19+
labels:
20+
- automation
21+
- title: Other changes
22+
labels:
23+
- "*"
+17-26
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
name: Create Release Branch
22

33
on:
4-
workflow_dispatch:
5-
inputs:
6-
version:
7-
description: 'Release Branch Version'
8-
required: false
4+
milestone:
5+
types:
6+
- closed
97

108
env:
119
artifactId: gaffer2
@@ -23,28 +21,11 @@ jobs:
2321
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
2422
fetch-depth: 0
2523

26-
- name: Set version from input
27-
if: ${{ github.event.inputs.version }}
28-
run: echo "RELEASE_VERSION=$(echo ${{ github.event.inputs.version }} | sed 's/^v//')" >> $GITHUB_ENV
29-
30-
- name: Get latest tag
31-
if: ${{ !github.event.inputs.version }}
32-
uses: actions-ecosystem/action-get-latest-tag@v1
33-
id: get-latest-tag
34-
35-
- name: Format latest tag
36-
if: ${{ !github.event.inputs.version }}
37-
run: echo "CURRENT_VERSION=$(echo ${{ steps.get-latest-tag.outputs.tag }} | sed 's/^gaffer2-//')" >> $GITHUB_ENV
38-
39-
- name: Bump latest tag variable version
40-
if: ${{ !github.event.inputs.version }}
41-
run: echo "RELEASE_VERSION=$(echo ${{ env.CURRENT_VERSION }} | sed -r 's/([0-9]+)\.([0-9]+)\.([0-9]+)/echo \1.$((\2+1)).0/' | sh)" >> $GITHUB_ENV
42-
43-
- name: Verify version regex
44-
run: echo ${{ env.RELEASE_VERSION }} | grep -E '^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$'
24+
- name: Set version from milestone
25+
run: echo "RELEASE_VERSION=$(echo ${{ github.event.milestone.title }})" >> $GITHUB_ENV
4526

4627
- name: Set release branch
47-
run: echo "BRANCH_NAME=$(echo release/${{ env.RELEASE_VERSION }} )" >> $GITHUB_ENV
28+
run: echo "BRANCH_NAME=$(echo release/"${{ env.RELEASE_VERSION }}" )" >> $GITHUB_ENV
4829

4930
- name: Set up Github credentials
5031
run: |
@@ -54,10 +35,20 @@ jobs:
5435
- name: Update versions
5536
run: |
5637
mvn versions:set-property -Dproperty=revision -DnewVersion=${RELEASE_VERSION} -DgenerateBackupPoms=false
57-
sed -i'' -e "s/^gaffer.version=.*/gaffer.version=$RELEASE_VERSION/" rest-api/common-rest/src/main/resources/version.properties
5838
5939
- name: Push to release branch
6040
run: |
6141
git checkout -b $BRANCH_NAME
6242
git commit -a -m "prepare release $artifactId-$RELEASE_VERSION"
6343
git push --set-upstream origin $BRANCH_NAME
44+
45+
- name: Tag release branch
46+
run: |
47+
git tag gaffer2-$RELEASE_VERSION
48+
git push origin --tags
49+
50+
- name: Create PR to master
51+
run: |
52+
gh pr create -B master -H $BRANCH_NAME --title 'Merge release into master branch' --body 'Created by GH Action'
53+
env:
54+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yaml

+76-105
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
name: Full Release
22

33
on:
4-
milestone:
5-
types:
6-
- closed
4+
pull_request:
5+
branches:
6+
- master
7+
types: [closed]
78

89
env:
910
artifactId: gaffer2
1011
MAVEN_OPTS: -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.wagon.httpconnectionManager.ttlSeconds=25
1112

12-
1313
jobs:
14-
create-release-tag:
14+
deploy-release:
15+
if: ${{ github.event.pull_request.merged }}
1516
runs-on: ubuntu-latest
1617

1718
outputs:
18-
branch_name: ${{ steps.branch.outputs.branch_name }}
19+
release_version: ${{ steps.release-version.outputs.release_version }}
1920

2021
steps:
2122
- name: Setup JDK
@@ -36,106 +37,15 @@ jobs:
3637
git config user.name github-actions[bot]
3738
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
3839
39-
- name: Set release version
40-
run: echo "RELEASE_VERSION=$(echo ${{ github.event.milestone.title }} | cut -c 2-)" >> $GITHUB_ENV
41-
42-
- name: Set branch name
43-
run: echo "BRANCH_NAME=$(git branch -a | grep $RELEASE_VERSION | tail -n 1 | cut -c 18-)" >> $GITHUB_ENV
44-
45-
- name: Output branch name
46-
id: branch
47-
run: echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT
48-
49-
- name: Fail if branch output missing (no branch found)
50-
if: ${{ !steps.branch.outputs.branch_name }}
51-
run: exit 1
52-
53-
- name: Merge release into master
54-
run: |
55-
git checkout ${{ env.BRANCH_NAME }}
56-
git checkout master
57-
git merge ${{ env.BRANCH_NAME }}
58-
59-
- name: Push changes
60-
run: |
61-
git tag $artifactId-$RELEASE_VERSION
62-
git push origin $artifactId-$RELEASE_VERSION
63-
git push
64-
65-
update-develop:
66-
runs-on: ubuntu-latest
67-
needs:
68-
- create-release-tag
69-
70-
steps:
71-
- name: Checkout develop
72-
uses: actions/checkout@v4
73-
with:
74-
ref: develop
75-
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
76-
fetch-depth: 0
77-
78-
- name: Set up Github credentials
79-
run: |
80-
git config user.name github-actions[bot]
81-
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
82-
83-
- name: Setup JDK
84-
uses: actions/setup-java@v4
85-
with:
86-
distribution: 'zulu'
87-
java-version: '8'
88-
89-
- name: Merge release into develop
90-
run: |
91-
git checkout ${{ needs.create-release-tag.outputs.branch_name }}
92-
git checkout develop
93-
git merge ${{ needs.create-release-tag.outputs.branch_name }} --strategy-option theirs
94-
95-
- name: Update develop branch
40+
- name: Output release version
41+
id: release-version
9642
run: |
97-
git checkout develop
98-
mvn versions:set-property -Dproperty=revision -DnewVersion=$(echo ${{ github.event.milestone.title }} | cut -c 2-)-SNAPSHOT
99-
mvn build-helper:parse-version versions:set-property \
100-
-Dproperty=revision \
101-
-DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion}-SNAPSHOT
102-
NEW_GAFFER_VERSION=$(mvn -q help:evaluate -DforceStdout -Dexpression=pom.version)
103-
sed -i'' -e "s/^gaffer.version=.*/gaffer.version=$NEW_GAFFER_VERSION/" rest-api/common-rest/src/main/resources/version.properties
104-
git commit -a -m "prepare for next development iteration"
105-
git push
106-
107-
update-github-releases:
108-
runs-on: ubuntu-latest
109-
needs:
110-
- create-release-tag
111-
112-
steps:
113-
- name: Checkout Master
114-
uses: actions/checkout@v4
115-
with:
116-
ref: master
117-
118-
- name: Create Release Notes
119-
uses: docker://decathlon/release-notes-generator-action:3.1.5
120-
env:
121-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
122-
123-
- name: Set version
124-
run: echo "RELEASE_VERSION=$(echo ${{ github.event.milestone.title }} | cut -c 2-)" >> $GITHUB_ENV
125-
126-
- name: Upload notes
127-
uses: softprops/action-gh-release@v2
128-
env:
129-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
130-
with:
131-
tag_name: ${{ env.artifactId }}-${{ env.RELEASE_VERSION }}
132-
name: Gaffer ${{ env.RELEASE_VERSION }}
133-
body_path: release_file.md
43+
echo "release_version=$(mvn -q help:evaluate -DforceStdout -Dexpression=pom.version)" >> $GITHUB_OUTPUT
13444
13545
generate-javadoc:
13646
runs-on: ubuntu-latest
13747
needs:
138-
- create-release-tag
48+
- deploy-release
13949

14050
steps:
14151
- name: Checkout Master
@@ -156,7 +66,7 @@ jobs:
15666
java-version: '11'
15767

15868
- name: Set version
159-
run: echo "RELEASE_VERSION=$(echo ${{ github.event.milestone.title }} | cut -c 2-)" >> $GITHUB_ENV
69+
run: echo "RELEASE_VERSION=$(echo ${{ needs.deploy-release.outputs.release_version }})" >> $GITHUB_ENV
16070

16171
- name: Upload Javadoc
16272
run: |
@@ -176,7 +86,7 @@ jobs:
17686
release-to-nexus:
17787
runs-on: ubuntu-latest
17888
needs:
179-
- create-release-tag
89+
- deploy-release
18090

18191
steps:
18292
- name: Setup JDK
@@ -188,7 +98,7 @@ jobs:
18898
- name: Checkout release
18999
uses: actions/checkout@v4
190100
with:
191-
ref: ${{ needs.create-release-tag.outputs.branch_name }}
101+
ref: master
192102

193103
- name: Decode CodeSigning key
194104
env:
@@ -205,4 +115,65 @@ jobs:
205115
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
206116
OSS_NEXUS_USERNAME: ${{ secrets.OSS_NEXUS_USERNAME }}
207117
OSS_NEXUS_PASSWORD: ${{ secrets.OSS_NEXUS_PASSWORD }}
208-
run: mvn deploy -P quick,ossrh-release --settings cd/mvnsettings.xml -B
118+
run:
119+
mvn deploy -P quick,ossrh-release --settings cd/mvnsettings.xml -B
120+
121+
update-github-releases:
122+
runs-on: ubuntu-latest
123+
needs:
124+
- deploy-release
125+
126+
steps:
127+
- name: Checkout Master
128+
uses: actions/checkout@v4
129+
with:
130+
ref: master
131+
132+
- name: Set version
133+
run: echo "RELEASE_VERSION=$(echo ${{ needs.deploy-release.outputs.release_version }})" >> $GITHUB_ENV
134+
135+
- name: Create github release
136+
uses: softprops/action-gh-release@v2
137+
env:
138+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
139+
with:
140+
tag_name: ${{ env.artifactId }}-${{ env.RELEASE_VERSION }}
141+
name: Gaffer ${{ env.RELEASE_VERSION }}
142+
143+
update-develop:
144+
runs-on: ubuntu-latest
145+
needs:
146+
- deploy-release
147+
148+
steps:
149+
- name: Checkout develop
150+
uses: actions/checkout@v4
151+
with:
152+
ref: develop
153+
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
154+
fetch-depth: 0
155+
156+
- name: Set up Github credentials
157+
run: |
158+
git config user.name github-actions[bot]
159+
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
160+
161+
- name: Setup JDK
162+
uses: actions/setup-java@v4
163+
with:
164+
distribution: 'zulu'
165+
java-version: '8'
166+
167+
- name: Merge master into develop
168+
run: |
169+
git merge origin/master
170+
171+
- name: Update develop branch
172+
run: |
173+
git checkout develop
174+
mvn versions:set-property -Dproperty=revision -DnewVersion=$(echo ${{ needs.deploy-release.outputs.release_version }})-SNAPSHOT
175+
mvn build-helper:parse-version versions:set-property \
176+
-Dproperty=revision \
177+
-DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion}-SNAPSHOT
178+
git commit -a -m "prepare for next development iteration"
179+
git push

0 commit comments

Comments
 (0)