-
Notifications
You must be signed in to change notification settings - Fork 8
85 lines (70 loc) · 2.51 KB
/
publish-hibernate-dialect.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: Publish YDB Hibernate Dialect
on:
push:
tags:
- 'hibernate-ydb/v[0-9]+.[0-9]+.[0-9]+'
env:
MAVEN_ARGS: --batch-mode --no-transfer-progress -Dstyle.color=always
jobs:
validate:
name: Validate YDB Hibernate Dialect
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Extract hibernate dialect version
run: |
cd hibernate-dialect
HIBERNATE_DIALECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "HIBERNATE_DIALECT_VERSION=$HIBERNATE_DIALECT_VERSION" >> "$GITHUB_ENV"
- name: Fail workflow if version is snapshot
if: endsWith(env.HIBERNATE_DIALECT_VERSION, 'SNAPSHOT')
uses: actions/github-script@v6
with:
script: core.setFailed('SNAPSHOT version cannot be published')
- name: Fail workflow if version is not equal to tag name
if: format('hibernate-ydb/v{0}', env.HIBERNATE_DIALECT_VERSION) != github.ref_name
uses: actions/github-script@v6
with:
script: core.setFailed('Release name must be equal to project version')
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
cache: 'maven'
- name: Download dependencies
run: |
cd hibernate-dialect
mvn $MAVEN_ARGS dependency:go-offline
- name: Build with Maven
run: |
cd hibernate-dialect
mvn $MAVEN_ARGS package
publish:
name: Publish YDB Hibernate Dialect
runs-on: ubuntu-latest
needs: validate
steps:
- name: Install gpg secret key
run: |
# Install gpg secret key
cat <(echo -e "${{ secrets.MAVEN_OSSRH_GPG_SECRET_KEY }}") | gpg --batch --import
# Verify gpg secret key
gpg --list-secret-keys --keyid-format LONG
- uses: actions/checkout@v4
- name: Set up Maven Central Repository
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
cache: 'maven'
server-id: ossrh-s01
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Publish package
run: |
cd hibernate-dialect
mvn $MAVEN_ARGS -Possrh-s01 -Dgpg.passphrase=${{ secrets.MAVEN_OSSRH_GPG_PASSWORD }} clean deploy
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_OSSRH_TOKEN }}