Skip to content

Commit 9be6713

Browse files
committed
added VERSION and updated workflow to take version from there
1 parent ad47b52 commit 9be6713

3 files changed

Lines changed: 41 additions & 40 deletions

File tree

.github/workflows/release.yml

Lines changed: 37 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ name: Release
22

33
on:
44
workflow_dispatch:
5-
inputs:
6-
version:
7-
description: "Release version"
8-
required: true
95

106
env:
117
CH_VERSION: "25.3"
@@ -15,11 +11,16 @@ jobs:
1511
name: "Build and Publish Artifact"
1612
runs-on: "ubuntu-latest"
1713

18-
permissions: write-all
14+
permissions:
15+
contents: write
1916

2017
steps:
2118
- name: Check out Git repository
2219
uses: actions/checkout@v4
20+
- name: Read release version
21+
id: version
22+
shell: bash
23+
run: echo "version=$(cat VERSION)" >> "$GITHUB_OUTPUT"
2324
- name: Install JDK and Maven
2425
uses: actions/setup-java@v4
2526
with:
@@ -28,6 +29,11 @@ jobs:
2829
8
2930
17
3031
cache: 'maven'
32+
server-id: central
33+
server-username: MAVEN_USERNAME
34+
server-password: MAVEN_PASSWORD
35+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
36+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
3137
- name: Setup Toolchain
3238
shell: bash
3339
run: |
@@ -48,43 +54,34 @@ jobs:
4854
EOF
4955
- name: Update Configuration
5056
run: |
51-
sed -i 's|<revision>.*</revision>|<revision>${{ github.event.inputs.version }}</revision>|g' pom.xml
57+
sed -i 's|<revision>.*</revision>|<revision>${{ steps.version.outputs.version }}</revision>|g' pom.xml
5258
find . -type f -name "simplelogger.*" -exec rm -fv '{}' \;
5359
- name: Release Maven package
54-
uses: samuelmeuli/action-maven-publish@v1
55-
with:
56-
maven_profiles: release
57-
maven_args: -q --batch-mode -DclickhouseVersion=${{ env.CH_VERSION }}
58-
server_id: central
59-
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
60-
gpg_passphrase: ${{ secrets.GPG_PASSPHRASE }}
61-
nexus_username: ${{ secrets.SONATYPE_TOKEN_USER }}
62-
nexus_password: ${{ secrets.SONATYPE_TOKEN }}
60+
env:
61+
MAVEN_USERNAME: ${{ secrets.SONATYPE_TOKEN_USER }}
62+
MAVEN_PASSWORD: ${{ secrets.SONATYPE_TOKEN }}
63+
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
64+
run: mvn -q --batch-mode -P release -DclickhouseVersion=${{ env.CH_VERSION }} clean deploy
6365
- name: Release R2DBC 0.9.1
64-
uses: samuelmeuli/action-maven-publish@v1
65-
with:
66-
directory: clickhouse-r2dbc
67-
maven_profiles: release
68-
maven_args: -q --batch-mode -Dr2dbc-spi.version=0.9.1.RELEASE -DclickhouseVersion=${{ env.CH_VERSION }}
69-
server_id: central
70-
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
71-
gpg_passphrase: ${{ secrets.GPG_PASSPHRASE }}
72-
nexus_username: ${{ secrets.SONATYPE_TOKEN_USER }}
73-
nexus_password: ${{ secrets.SONATYPE_TOKEN }}
66+
working-directory: clickhouse-r2dbc
67+
env:
68+
MAVEN_USERNAME: ${{ secrets.SONATYPE_TOKEN_USER }}
69+
MAVEN_PASSWORD: ${{ secrets.SONATYPE_TOKEN }}
70+
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
71+
run: mvn -q --batch-mode -P release -Dr2dbc-spi.version=0.9.1.RELEASE -DclickhouseVersion=${{ env.CH_VERSION }} clean deploy
7472
- name: Create Pre-release on Github
75-
uses: "zhicwu/action-automatic-releases@latest"
76-
with:
77-
repo_token: "${{ secrets.GITHUB_TOKEN }}"
78-
automatic_release_tag: "v${{ github.event.inputs.version }}"
79-
prerelease: true
80-
title: "Release v${{ github.event.inputs.version }}"
81-
files: |
82-
LICENSE
83-
clickhouse-client/target/clickhouse*.jar
84-
clickhouse-data/target/clickhouse*.jar
85-
clickhouse-http-client/target/clickhouse*.jar
86-
clickhouse-jdbc/target/clickhouse*.jar
87-
clickhouse-jdbc/target/bundle/clickhouse*.jar
88-
clickhouse-r2dbc/target/clickhouse*.jar
89-
client-v2/target/client-v2*.jar
73+
env:
74+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75+
run: |
76+
gh release create "v${{ steps.version.outputs.version }}" \
77+
--prerelease \
78+
--title "Release v${{ steps.version.outputs.version }}" \
79+
LICENSE \
80+
clickhouse-client/target/clickhouse*.jar \
81+
clickhouse-data/target/clickhouse*.jar \
82+
clickhouse-http-client/target/clickhouse*.jar \
83+
clickhouse-jdbc/target/clickhouse*.jar \
84+
clickhouse-jdbc/target/bundle/clickhouse*.jar \
85+
clickhouse-r2dbc/target/clickhouse*.jar \
86+
client-v2/target/client-v2*.jar \
9087
jdbc-v2/target/jdbc-v2*.jar

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.10.0-rc1

release.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ if [ -z "$RELEASE_VERSION" ]; then
88
fi
99
echo "Release version: $RELEASE_VERSION"
1010

11+
# write version to VERSION file (consumed by the release workflow)
12+
printf '%s\n' "$RELEASE_VERSION" > VERSION
13+
1114
# update version in main pom.xml
1215
sed -i "s|<clickhouse-java.version>.*<\/clickhouse-java.version>|<clickhouse-java.version>${RELEASE_VERSION}<\/clickhouse-java.version>|g" pom.xml
1316

0 commit comments

Comments
 (0)