Skip to content

Commit 5b57bcb

Browse files
Initial commit
1 parent 88cae43 commit 5b57bcb

37 files changed

Lines changed: 3213 additions & 5 deletions

.github/actions/build/action.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Maven Build
2+
description: "Builds a Maven project."
3+
4+
inputs:
5+
java-version:
6+
description: "The Java version the build shall run with."
7+
required: true
8+
maven-version:
9+
description: "The Maven version the build shall run with."
10+
required: true
11+
12+
runs:
13+
using: composite
14+
steps:
15+
- name: Set up Java ${{ inputs.java-version }}
16+
uses: actions/setup-java@v4
17+
with:
18+
distribution: sapmachine
19+
java-version: ${{ inputs.java-version }}
20+
cache: maven
21+
22+
- name: Setup Maven ${{ inputs.maven-version }}
23+
uses: stCarolas/setup-maven@v5
24+
with:
25+
maven-version: ${{ inputs.maven-version }}
26+
27+
- name: Piper Maven build
28+
uses: SAP/project-piper-action@main
29+
with:
30+
step-name: mavenBuild
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Prepare Next Version
2+
description: "Updates the revision property in the POM file, creates the changelog entry and opens a pull request."
3+
4+
inputs:
5+
java-version:
6+
description: "The Java version the build shall run with."
7+
required: true
8+
maven-version:
9+
description: "The Maven version the build shall run with."
10+
required: true
11+
new-version:
12+
description: "New version (MAJOR.MINOR.PATCH)"
13+
required: true
14+
changelog-file:
15+
description: "The changelog file to update."
16+
required: true
17+
18+
runs:
19+
using: composite
20+
steps:
21+
- name: Set up Java ${{ inputs.java-version }}
22+
uses: actions/setup-java@v4
23+
with:
24+
java-version: ${{ inputs.java-version }}
25+
distribution: sapmachine
26+
cache: maven
27+
28+
- name: Setup Maven ${{ inputs.maven-version }}
29+
uses: stCarolas/setup-maven@v5
30+
with:
31+
maven-version: ${{ inputs.maven-version }}
32+
33+
- name: Update version
34+
env:
35+
NEW_VERSION: ${{ inputs.new-version }}
36+
run: |
37+
mvn --no-transfer-progress versions:set-property -Dproperty=revision -DnewVersion=NEW_VERSION
38+
shell: bash
39+
40+
- name: Replace Unreleased entry in ${{ inputs.changelog-file }}
41+
env:
42+
NEW_VERSION: ${{ inputs.new-version }}
43+
CHANGELOG_FILE: ${{ inputs.changelog-file }}
44+
run: |
45+
CURRENT_DATE=$(date +%Y-%m-%d)
46+
sed -i -E "0,/^##\s+.*\[Unreleased\].*$/s//## [Unreleased]\\
47+
\\
48+
### Added\\
49+
### Changed\\
50+
### Deprecated\\
51+
### Removed\\
52+
### Fixed\\
53+
### Security\\
54+
\\
55+
## [${NEW_VERSION}] - ${CURRENT_DATE}/" $CHANGELOG_FILE
56+
head -n 20 $CHANGELOG_FILE
57+
shell: bash
58+
59+
- name: Create Pull Request
60+
uses: peter-evans/create-pull-request@v7
61+
with:
62+
commit-message: chore/release-${{ inputs.new-version }}
63+
title: "chore(version): version ${{ inputs.new-version }}"
64+
body: Set version to ${{ inputs.new-version }}
65+
branch: chore/release-${{ inputs.new-version }}
66+
reviewers: ${{ github.actor }}

.github/actions/release/action.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Release to Maven Central
2+
description: "Releases artifacts to Maven Central repository."
3+
4+
inputs:
5+
user:
6+
description: "The user used for the upload (technical user for maven central upload)"
7+
required: true
8+
password:
9+
description: "The password used for the upload (technical user for maven central upload)"
10+
required: true
11+
pgp-pub-key:
12+
description: "The public pgp key ID"
13+
required: true
14+
pgp-private-key:
15+
description: "The private pgp key"
16+
required: true
17+
pgp-passphrase:
18+
description: "The passphrase for pgp"
19+
required: true
20+
java-version:
21+
description: "The Java version the build shall run with."
22+
required: true
23+
maven-version:
24+
description: "The Maven version the build shall run with."
25+
required: true
26+
27+
runs:
28+
using: composite
29+
steps:
30+
- name: Set up Java
31+
uses: actions/setup-java@v4
32+
with:
33+
distribution: sapmachine
34+
java-version: ${{ inputs.java-version }}
35+
cache: maven
36+
server-id: central
37+
server-username: MAVEN_CENTRAL_USER
38+
server-password: MAVEN_CENTRAL_PASSWORD
39+
40+
- name: Set up Maven ${{ inputs.maven-version }}
41+
uses: stCarolas/setup-maven@v5
42+
with:
43+
maven-version: ${{ inputs.maven-version }}
44+
45+
- name: Import GPG Key
46+
run: |
47+
echo "${{ inputs.pgp-private-key }}" | gpg --batch --passphrase "$PASSPHRASE" --import
48+
shell: bash
49+
env:
50+
PASSPHRASE: ${{ inputs.pgp-passphrase }}
51+
52+
- name: Deploy to Maven Central
53+
run: >
54+
mvn -B -ntp --show-version
55+
-Dmaven.install.skip=true
56+
-Dmaven.test.skip=true
57+
-Dgpg.passphrase="$GPG_PASSPHRASE"
58+
-Dgpg.keyname="$GPG_PUB_KEY"
59+
clean deploy -P deploy-release
60+
shell: bash
61+
env:
62+
MAVEN_CENTRAL_USER: ${{ inputs.user }}
63+
MAVEN_CENTRAL_PASSWORD: ${{ inputs.password }}
64+
GPG_PASSPHRASE: ${{ inputs.pgp-passphrase }}
65+
GPG_PUB_KEY: ${{ inputs.pgp-pub-key }}

.github/workflows/build.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: PR Build
2+
3+
env:
4+
MAVEN_VERSION: '3.9.11'
5+
6+
on:
7+
pull_request:
8+
branches: [ "main" ]
9+
push:
10+
branches: [ "main" ]
11+
permissions:
12+
contents: write
13+
id-token: write
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
strategy:
19+
matrix:
20+
java-version: [ 17, 21 ]
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v5
24+
25+
- name: Build
26+
uses: ./.github/actions/build
27+
with:
28+
java-version: ${{ matrix.java-version }}
29+
maven-version: ${{ env.MAVEN_VERSION }}

.github/workflows/pr-checks.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: PR Checks
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
pull_request:
8+
types: [opened, synchronize, reopened, edited, labeled, unlabeled, ready_for_review, review_requested, review_request_removed, auto_merge_enabled, auto_merge_disabled]
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.head_ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
enforce-changelog:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Check changelog
19+
uses: cap-js/.github/.github/actions/check-changelog@main
20+
21+
check-pr-title:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Check PR title
25+
uses: cap-js/.github/.github/actions/check-pr-title@main
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Deploy to Maven Central
2+
3+
env:
4+
JAVA_VERSION: '17'
5+
MAVEN_VERSION: '3.9.11'
6+
7+
on:
8+
workflow_dispatch:
9+
inputs:
10+
new-version:
11+
description: New version (MAJOR.MINOR.PATCH)
12+
required: true
13+
14+
permissions:
15+
contents: write
16+
pull-requests: write
17+
18+
jobs:
19+
update-version:
20+
name: Update Version
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v5
25+
with:
26+
token: ${{ secrets.GH_TOKEN }}
27+
- name: Update version
28+
uses: ./.github/actions/prepare-next-version
29+
with:
30+
java-version: ${{ env.JAVA_VERSION }}
31+
maven-version: ${{ env.MAVEN_VERSION }}
32+
new-version: ${{ github.event.inputs.new-version }}

.github/workflows/release.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Deploy to Maven Central
2+
3+
env:
4+
JAVA_VERSION: '17'
5+
MAVEN_VERSION: '3.9.11'
6+
7+
on:
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: write
12+
13+
jobs:
14+
build:
15+
name: Build
16+
runs-on: ubuntu-latest
17+
needs: update-version
18+
steps:
19+
- name: Download artifact
20+
uses: actions/download-artifact@v5
21+
with:
22+
name: root-new-version
23+
- name: Build
24+
uses: ./.github/actions/build
25+
with:
26+
java-version: ${{ env.JAVA_VERSION }}
27+
maven-version: ${{ env.MAVEN_VERSION }}
28+
- name: Upload Changed Artifacts
29+
uses: actions/upload-artifact@v4
30+
with:
31+
name: root-build
32+
include-hidden-files: true
33+
path: .
34+
retention-days: 1
35+
36+
deploy:
37+
name: Deploy to Maven Central
38+
runs-on: ubuntu-latest
39+
needs: [build]
40+
steps:
41+
- name: Download artifact
42+
uses: actions/download-artifact@v5
43+
with:
44+
name: root-build
45+
- name: Deploy
46+
uses: ./.github/actions/release
47+
with:
48+
user: ${{ secrets.CENTRAL_REPOSITORY_USER }}
49+
password: ${{ secrets.CENTRAL_REPOSITORY_PASS }}
50+
pgp-pub-key: ${{ secrets.PGP_PUBKEY_ID }}
51+
pgp-private-key: ${{ secrets.PGP_PRIVATE_KEY }}
52+
pgp-passphrase: ${{ secrets.PGP_PASSPHRASE }}
53+
maven-version: ${{ env.MAVEN_VERSION }}

.gitignore

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
**/.mta
2+
**/*.mtar
3+
bin/
4+
target/
5+
pom.xml.tag
6+
pom.xml.releaseBackup
7+
pom.xml.versionsBackup
8+
pom.xml.next
9+
release.properties
10+
dependency-reduced-pom.xml
11+
buildNumber.properties
12+
package-lock.json
13+
*.log*
14+
gc_history*
15+
hs_err*
16+
.flattened-pom.xml
17+
.mvn/timing.properties
18+
.DS_Store
19+
.classpath
20+
.project
21+
.settings
22+
.vscode
23+
node
24+
node_modules
25+
model*.json
26+
model*.sql
27+
*model.sql
28+
*.csn
29+
csn.json
30+
classpath-data.json
31+
.factorypath
32+
*.iml
33+
/.idea/*
34+
!/.idea/codeStyles
35+
.java-version
36+
37+
# Intellij Coverage Reports
38+
htmlReport/
39+
40+
# Avoid ignoring Maven wrapper jar file (.jar files are usually ignored)
41+
!/.mvn/wrapper/maven-wrapper.jar
42+
.groovylintrc.json
43+
**/src/gen/**
44+
/.scannerwork

0 commit comments

Comments
 (0)