Skip to content

Commit cf7e2e7

Browse files
feat: rename module add ci + publish
1 parent 226a474 commit cf7e2e7

File tree

10 files changed

+136
-3
lines changed

10 files changed

+136
-3
lines changed

.github/workflows/ci-shedlock.yaml

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

shaded-lock-ydb/pom.xml renamed to shedlock-ydb/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
<modelVersion>4.0.0</modelVersion>
66

77
<groupId>tech.ydb.dialects</groupId>
8-
<artifactId>shaded-lock-ydb</artifactId>
8+
<artifactId>shedlock-ydb</artifactId>
99
<version>0.1.0</version>
1010

1111
<packaging>jar</packaging>
1212

13-
<name>Shaded Lock Service YDB</name>
14-
<description>Shaded Lock Service YDB Spring Starter</description>
13+
<name>ShedLock Service YDB</name>
14+
<description>Lock Service YDB Spring Starter</description>
1515
<url>https://github.com/ydb-platform/ydb-java-dialects</url>
1616

1717
<developers>

shaded-lock-ydb/src/main/java/tech/ydb/lock/provider/YdbCoordinationServiceLockProvider.java renamed to shedlock-ydb/src/main/java/tech/ydb/lock/provider/YdbCoordinationServiceLockProvider.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public Optional<SimpleLock> lock(LockConfiguration lockConfiguration) {
6060
System.out.println(semaphoreLease.getStatus());
6161
return Optional.of(new YdbSimpleLock(semaphoreLease.getValue()));
6262
} else {
63+
logger.debug("Semaphore is not acquired");
6364
return Optional.empty();
6465
}
6566
}

0 commit comments

Comments
 (0)