Skip to content

Commit e56a440

Browse files
committed
chore: automate releases and CI
Set up semantic-release, commitlint, and Maven Central publishing workflows with tag-based versions.
1 parent ee26377 commit e56a440

File tree

13 files changed

+181
-164
lines changed

13 files changed

+181
-164
lines changed

.commitlintrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": ["@commitlint/config-conventional"]
3+
}

.github/dependabot.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches: ["main"]
6+
push:
7+
branches: ["main"]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
test:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4.2.2
17+
- uses: actions/setup-java@v5.1.0
18+
with:
19+
distribution: "temurin"
20+
java-version-file: .tool-versions
21+
cache: "gradle"
22+
- name: Run tests
23+
run: ./gradlew test

.github/workflows/commitlint.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Commitlint
2+
3+
on:
4+
pull_request:
5+
6+
permissions:
7+
contents: read
8+
pull-requests: read
9+
10+
jobs:
11+
commitlint:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4.2.2
15+
with:
16+
fetch-depth: 0
17+
- uses: wagoid/commitlint-github-action@v6.1.2

.github/workflows/publish.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
tags: ["v*"]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
publish:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4.2.2
15+
with:
16+
fetch-depth: 0
17+
- uses: actions/setup-java@v5.1.0
18+
with:
19+
distribution: "temurin"
20+
java-version-file: .tool-versions
21+
cache: "gradle"
22+
- name: Publish to Maven Central
23+
env:
24+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
25+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
26+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
27+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
28+
run: ./gradlew -PVERSION_NAME=${GITHUB_REF_NAME#v} publishToMavenCentral

.github/workflows/release.yml

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,44 @@
11
name: Release
22

33
on:
4-
push:
5-
tags:
6-
- 'v*'
4+
workflow_run:
5+
workflows: ["CI"]
6+
branches: ["main"]
7+
types: [completed]
78

8-
env:
9-
GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dorg.gradle.parallel=false"
9+
permissions:
10+
contents: write
11+
issues: write
12+
pull-requests: write
13+
14+
concurrency:
15+
group: release
16+
cancel-in-progress: false
1017

1118
jobs:
1219
release:
20+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
1321
runs-on: ubuntu-latest
1422
steps:
15-
- uses: actions/checkout@v5
16-
- name: Set up JDK
17-
uses: actions/setup-java@v5
23+
- uses: actions/checkout@v4.2.2
1824
with:
19-
distribution: 'temurin'
20-
java-version: 21
21-
cache: 'gradle'
22-
- name: Load secrets from 1Password
23-
uses: 1password/load-secrets-action@v2
25+
fetch-depth: 0
26+
ref: ${{ github.event.workflow_run.head_sha }}
27+
- uses: actions/setup-java@v5.1.0
2428
with:
25-
export-env: true
26-
env:
27-
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
28-
GPG_PRIVATE_KEY: "op://Private/GPG-Signing-Key/private-key"
29-
GPG_PASSPHRASE: "op://Private/GPG-Signing-Key/passphrase"
30-
CENTRAL_USERNAME: "op://Private/Maven-Central/username"
31-
CENTRAL_PASSWORD: "op://Private/Maven-Central/password"
32-
- name: Publish to Maven Central
33-
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
29+
distribution: "temurin"
30+
java-version-file: .tool-versions
31+
cache: "gradle"
32+
- uses: actions/setup-node@v4.0.3
33+
with:
34+
node-version-file: .tool-versions
35+
- name: Install semantic-release
36+
run: npm install --global semantic-release @semantic-release/changelog @semantic-release/git @semantic-release/github @semantic-release/exec conventional-changelog-conventionalcommits
37+
- name: Run semantic-release
3438
env:
35-
ORG_GRADLE_PROJECT_signingKey: ${{ env.GPG_PRIVATE_KEY }}
36-
ORG_GRADLE_PROJECT_signingPassword: ${{ env.GPG_PASSPHRASE }}
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
41+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
42+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
43+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
44+
run: semantic-release

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.mise.toml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
# Mise configuration for Lexware Java SDK
22
# https://mise.jdx.dev
33

4-
[tools]
5-
java = "temurin-21"
6-
74
[tasks.build]
85
description = "Build and install locally"
96
run = "./gradlew build publishToMavenLocal"
@@ -20,10 +17,6 @@ run = "./gradlew test"
2017
description = "Build JARs without running tests"
2118
run = "./gradlew assemble"
2219

23-
[tasks.release]
24-
description = "Build with GPG signing and Maven Central publishing"
25-
run = "./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository"
26-
2720
[tasks.clean]
2821
description = "Clean build artifacts"
2922
run = "./gradlew clean"

.releaserc.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"branches": ["main"],
3+
"tagFormat": "v${version}",
4+
"repositoryUrl": "https://github.com/octalog-de/lexware-java-sdk",
5+
"plugins": [
6+
[
7+
"@semantic-release/commit-analyzer",
8+
{
9+
"preset": "angular",
10+
"releaseRules": [
11+
{"type": "chore", "release": "patch"},
12+
{"type": "chore", "scope": "project", "release": false},
13+
{"type": "chore", "scope": "deps", "release": false},
14+
{"type": "refactor", "release": "patch"},
15+
{"type": "ci", "release": "patch"},
16+
{"type": "test", "release": false},
17+
{"type": "docs", "release": "patch"}
18+
],
19+
"parserOpts": {
20+
"noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES"]
21+
}
22+
}
23+
],
24+
[
25+
"@semantic-release/release-notes-generator",
26+
{
27+
"preset": "conventionalcommits",
28+
"presetConfig": {
29+
"types": [
30+
{"type": "feat", "section": "✨ Features", "hidden": false},
31+
{"type": "fix", "scope": "deps", "section": "📦‍ Dependencies", "hidden": false},
32+
{"type": "fix", "section": "🐛 Bug Fixes", "hidden": false},
33+
{"type": "chore", "scope": "deps", "section": "📦‍ Dependencies", "hidden": false},
34+
{"type": "chore", "section": "🛠️ Maintenance", "hidden": false},
35+
{"type": "refactor", "section": "🛠️ Maintenance", "hidden": false},
36+
{"type": "ci", "section": "🛠️ Maintenance", "hidden": false},
37+
{"type": "test", "section": "🛠️ Maintenance", "hidden": false},
38+
{"type": "docs", "section": "📚 Documentation", "hidden": false},
39+
{"type": "revert", "section": "🔙 Reverts", "hidden": false}
40+
]
41+
}
42+
}
43+
],
44+
"@semantic-release/github"
45+
]
46+
}

0 commit comments

Comments
 (0)