Skip to content

Commit 154d87e

Browse files
committed
ci: update release workflow [skip ci]
1 parent 669a804 commit 154d87e

File tree

2 files changed

+68
-84
lines changed

2 files changed

+68
-84
lines changed

.github/workflows/release.yml

+67-83
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,13 @@ name: Releases
99
on:
1010
workflow_dispatch:
1111
inputs:
12-
newVersion:
12+
version:
1313
type: string
1414
required: false
1515
description: "New version (if null use current version)"
16-
createTag:
17-
type: boolean
18-
required: true
19-
description: "Create a Tag"
20-
default: true
16+
next:
17+
description: "Next version"
18+
required: false
2119
generateDoc:
2220
type: boolean
2321
required: true
@@ -33,6 +31,7 @@ jobs:
3331
outputs:
3432
HEAD: ${{ steps.version.outputs.HEAD }}
3533
RELEASE_VERSION: ${{ steps.version.outputs.RELEASE_VERSION }}
34+
NEXT_VERSION: ${{ steps.version.outputs.NEXT_VERSION }}
3635
steps:
3736
- name: 'Checkout GitHub repository'
3837
uses: actions/checkout@v4
@@ -56,78 +55,73 @@ jobs:
5655
- name: 'Grant execute permission to MVN Wrapper'
5756
run: chmod +x ./mvnw
5857

59-
- name: Update release version
60-
if: "${{ github.event.inputs.newVersion == '' }}"
61-
run: |
62-
echo 'Remove snapshot from maven version'
63-
./mvnw -q versions:set -DremoveSnapshot -DprocessAllModules -DgenerateBackupPoms=false
64-
65-
- name: Set specific version to release
66-
if: "${{ github.event.inputs.newVersion != '' }}"
67-
run: |
68-
./mvnw -q versions:set -DnewVersion=${{ github.event.inputs.newVersion }}
69-
70-
- name: 'Set env RELEASE_VERSION'
71-
run: |
72-
RELEASE_VERSION=$(./mvnw org.apache.maven.plugins:maven-help-plugin:3.1.0:evaluate -Dexpression=project.version -q -DforceStdout)
73-
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
74-
75-
- name: 'Update Documentation'
76-
if: "${{ github.event.inputs.generateDoc == 'true' }}"
77-
run: |
78-
DOC_BASEDIR="./docs/content/en/docs"
79-
RELEASE_DOC_VERSION=$(echo ${{ env.RELEASE_VERSION }} | sed 's/\([0-9]\)\s*$/\x/')
80-
RELEASE_DOC_DIR="$DOC_BASEDIR/Archives/v${{ env.RELEASE_VERSION }}"
81-
RELEASE_DOC_LINK=$(echo ${{ env.RELEASE_VERSION }} | sed -r 's/\.+/-/g')
82-
RELEASE_DOC_LINK=${RELEASE_DOC_LINK%??}
83-
DIRS=(
84-
"Developer Guide"
85-
"Examples"
86-
"FAQ"
87-
"Getting started"
88-
"Overview"
89-
"Project Info"
90-
)
91-
echo "Creating release site documentation: v$RELEASE_DOC_VERSION"
92-
mkdir -p "$RELEASE_DOC_DIR"
93-
for DIR in "${DIRS[@]}"; do
94-
echo "Copying $DIR to $DOC_BASEDIR/$DIR";
95-
cp -r "$DOC_BASEDIR/$DIR" "$RELEASE_DOC_DIR";
96-
done
97-
98-
echo "Creating $RELEASE_DOC_DIR/_index.md"
99-
cat > "$RELEASE_DOC_DIR/_index.md" <<EOF
100-
---
101-
title: "Docs Release v$RELEASE_DOC_VERSION"
102-
linkTitle: "v$RELEASE_DOC_VERSION"
103-
url: "/v$RELEASE_DOC_LINK/docs"
104-
---
105-
This section is where the user documentation for Connect File Pulse lives - all the information that users need to understand and successfully use Connect File Pulse.
106-
EOF
107-
108-
echo "Updating ./docs/config.toml"
109-
cat >> "./docs/config.toml" <<EOF
110-
[[params.versions]]
111-
version = "v$RELEASE_DOC_VERSION"
112-
url = "/kafka-connect-file-pulse/v$RELEASE_DOC_LINK/docs"
113-
EOF
114-
11558
- name: 'Configure Git'
11659
run: |
11760
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
11861
git config --global user.name "github-actions[bot]"
11962
120-
- name: 'Push release version'
63+
- name: 'Update Documentation'
64+
if: "${{ github.event.inputs.generateDoc == 'true' }}"
65+
run: |
66+
RELEASE_VERSION=${{ github.event.inputs.version }}
67+
68+
DOC_BASEDIR="./docs/content/en/docs"
69+
RELEASE_DOC_VERSION=$(echo ${{ env.RELEASE_VERSION }} | sed 's/\([0-9]\)\s*$/\x/')
70+
RELEASE_DOC_DIR="$DOC_BASEDIR/Archives/v${{ env.RELEASE_VERSION }}"
71+
RELEASE_DOC_LINK=$(echo ${{ env.RELEASE_VERSION }} | sed -r 's/\.+/-/g')
72+
RELEASE_DOC_LINK=${RELEASE_DOC_LINK%??}
73+
DIRS=(
74+
"Developer Guide"
75+
"Examples"
76+
"FAQ"
77+
"Getting started"
78+
"Overview"
79+
"Project Info"
80+
)
81+
echo "Creating release site documentation: v$RELEASE_DOC_VERSION"
82+
mkdir -p "$RELEASE_DOC_DIR"
83+
for DIR in "${DIRS[@]}"; do
84+
echo "Copying $DIR to $DOC_BASEDIR/$DIR";
85+
cp -r "$DOC_BASEDIR/$DIR" "$RELEASE_DOC_DIR";
86+
done
87+
88+
echo "Creating $RELEASE_DOC_DIR/_index.md"
89+
cat > "$RELEASE_DOC_DIR/_index.md" <<EOF
90+
---
91+
title: "Docs Release v$RELEASE_DOC_VERSION"
92+
linkTitle: "v$RELEASE_DOC_VERSION"
93+
url: "/v$RELEASE_DOC_LINK/docs"
94+
---
95+
This section is where the user documentation for Connect File Pulse lives - all the information that users need to understand and successfully use Connect File Pulse.
96+
EOF
97+
98+
echo "Updating ./docs/config.toml"
99+
cat >> "./docs/config.toml" <<EOF
100+
[[params.versions]]
101+
version = "v$RELEASE_DOC_VERSION"
102+
url = "/kafka-connect-file-pulse/v$RELEASE_DOC_LINK/docs"
103+
EOF
104+
105+
- name: 'Set release version'
121106
id: version
122-
if: "${{ github.event.inputs.createTag == 'true' }}"
123107
run: |
124-
git add "./docs/*"
108+
RELEASE_VERSION=${{ github.event.inputs.version }}
109+
NEXT_VERSION=${{ github.event.inputs.next }}
110+
if [ -z $NEXT_VERSION ]
111+
then
112+
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); }'`
113+
NEXT_VERSION="${PLAIN_VERSION}-SNAPSHOT"
114+
fi
115+
chmod +x ./mvnw
116+
./mvnw -ntp -B versions:set versions:commit -DnewVersion=$RELEASE_VERSION
125117
find . -name 'pom.xml' | xargs git add
126-
git commit -m "ci: release version ${{ env.RELEASE_VERSION }} 🎉"
118+
git commit -m "ci: release version $RELEASE_VERSION 🎉"
127119
git push --atomic origin HEAD:${GITHUB_REF#refs/heads/}
128-
HEAD=$(git rev-parse HEAD)
120+
HEAD=${GITHUB_REF#refs/heads/}
129121
echo "HEAD=$HEAD" >> $GITHUB_OUTPUT
130122
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_OUTPUT
123+
echo "NEXT_VERSION=$NEXT_VERSION" >> $GITHUB_OUTPUT
124+
131125
132126
build-distribution:
133127
needs: [ set-release-version ]
@@ -172,9 +166,6 @@ jobs:
172166

173167
- name: 'Download all artifacts'
174168
uses: actions/download-artifact@v4
175-
with:
176-
merge-multiple: true
177-
path: artifacts
178169

179170
- name: 'Set up Java'
180171
uses: actions/setup-java@v3
@@ -200,7 +191,7 @@ jobs:
200191
JRELEASER_GITHUB_TOKEN: ${{ secrets.PAT }}
201192
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }}
202193
JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
203-
JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
194+
JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
204195
run: ./mvnw -ntp -B --file ./pom.xml -Prelease -DartifactsDir=artifacts jreleaser:full-release
205196

206197
- name: 'JReleaser output'
@@ -212,18 +203,11 @@ jobs:
212203
target/jreleaser/trace.log
213204
target/jreleaser/output.properties
214205
215-
- name: 'Bump version for next iteration'
216-
if: "${{ github.event.inputs.newVersion == '' }}"
217-
run: |
218-
./mvnw -q build-helper:parse-version versions:set \
219-
-DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.nextMinorVersion}.0-SNAPSHOT \
220-
versions:commit
221-
NEXT_VERSION=$(./mvnw org.apache.maven.plugins:maven-help-plugin:3.1.0:evaluate -Dexpression=project.version -q -DforceStdout)
222-
echo "NEXT_VERSION=$NEXT_VERSION" >> $GITHUB_ENV
223-
224-
- name: 'Commit Bump Version'
225-
if: "${{ github.event.inputs.newVersion == '' }}"
206+
- name: 'Commit Next Version'
207+
env:
208+
NEXT_VERSION: ${{ needs.set-release-version.outputs.NEXT_VERSION }}
226209
run: |
210+
./mvnw -ntp -B versions:set versions:commit -DnewVersion=${{ env.NEXT_VERSION }}
227211
find . -name 'pom.xml' | xargs git add
228212
git commit -m "ci: bump version for next iteration to ${{ env.NEXT_VERSION }} 🤖"
229-
git push origin HEAD:${{ needs.set-release-version.outputs.HEAD }}
213+
git push origin HEAD:${GITHUB_REF#refs/heads/}

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
<maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
8989
<maven-jar-plugin.version>3.3.0</maven-jar-plugin.version>
9090
<apache.avro.version>1.8.2</apache.avro.version>
91-
<jreleaser-maven-plugin.version>1.17.0</jreleaser-maven-plugin.version>
91+
<jreleaser-maven-plugin.version>1.16.0</jreleaser-maven-plugin.version>
9292
<confluent.maven.repo>https://packages.confluent.io/maven/</confluent.maven.repo>
9393
<!-- DEPENDENCIES -->
9494
<io.confluent.version>7.9.0</io.confluent.version>

0 commit comments

Comments
 (0)