Skip to content

Commit c5308e7

Browse files
committed
chore: 🎉 Adds initial project structure resources
1 parent e5170ac commit c5308e7

File tree

10 files changed

+778
-0
lines changed

10 files changed

+778
-0
lines changed

‎.github/workflows/maven.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
3+
4+
# This workflow uses actions that are not certified by GitHub.
5+
# They are provided by a third-party and are governed by
6+
# separate terms of service, privacy policy, and support
7+
# documentation.
8+
9+
name: Java CI with Maven
10+
11+
on:
12+
workflow_dispatch:
13+
push:
14+
branches: [ "main" ]
15+
pull_request:
16+
branches: [ "main" ]
17+
18+
jobs:
19+
build:
20+
name: Build Java project with Maven
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
# Checks out a copy of project's repository.
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
with:
28+
# Shallow clones should be disabled for a better relevancy of analysis
29+
fetch-depth: 0
30+
31+
# Sets up the Java JDK, and also configures the Maven `settings.xml` file to add authentication for the
32+
# `ossrh` repository using the `OSSRH_USERNAME` and `OSSRH_TOKEN` environment variables.
33+
- name: Set up Project
34+
uses: actions/setup-java@v4
35+
with:
36+
java-version-file: '.java-version'
37+
distribution: 'temurin'
38+
cache: 'maven'
39+
cache-dependency-path: 'pom.yml'
40+
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
41+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
42+
43+
- name: Cache SonarCloud packages
44+
uses: actions/cache@v3
45+
with:
46+
path: ~/.sonar/cache
47+
key: ${{ runner.os }}-sonar
48+
restore-keys: ${{ runner.os }}-sonar
49+
50+
- name: Build and analyze
51+
env:
52+
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
54+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
55+
run: ./mvnw --batch-mode verify org.sonarsource.scanner.maven:sonar-maven-plugin:RELEASE:sonar
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# This workflow will build a Java project with Maven and publish artifact to Maven Central (https://search.maven.org)
2+
#
3+
# Additional information:
4+
# - https://docs.github.com/en/actions/publishing-packages/publishing-java-packages-with-maven#publishing-packages-to-the-maven-central-repository
5+
# - https://blogs.itemis.com/en/github-actions-releasing-artifacts-into-maven-central
6+
# - https://itnext.io/publishing-artifacts-to-maven-central-using-github-actions-a-step-by-step-guide-fd65ef075fd4
7+
# - https://github.com/naturalett/maven-hello-world/blob/main/.github/workflows/maven.yml
8+
name: Publish package to the Maven Central Repository
9+
10+
on:
11+
workflow_dispatch:
12+
push:
13+
tags: [ "*" ]
14+
15+
jobs:
16+
build:
17+
name: Build, release and publish to Maven Central
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
# Checks out a copy of project's repository.
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
with:
25+
# Shallow clones should be disabled for a better relevancy of analysis
26+
fetch-depth: 0
27+
28+
# Sets up the Java JDK, and also configures the Maven `settings.xml` file to add authentication for the
29+
# `ossrh` repository using the `OSSRH_USERNAME` and `OSSRH_TOKEN` environment variables.
30+
- name: Set up Project
31+
uses: actions/setup-java@v4
32+
with:
33+
java-version-file: '.java-version'
34+
distribution: 'temurin'
35+
cache: 'maven'
36+
cache-dependency-path: 'pom.yml'
37+
# must match the serverId configured for the nexus-staging-maven-plugin in the POM
38+
server-id: ossrh
39+
server-username: OSSRH_USERNAME
40+
server-password: OSSRH_TOKEN
41+
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
42+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
43+
44+
- name: Cache SonarCloud packages
45+
uses: actions/cache@v3
46+
with:
47+
path: ~/.sonar/cache
48+
key: ${{ runner.os }}-sonar
49+
restore-keys: ${{ runner.os }}-sonar
50+
51+
# Runs the Maven command to publish to the `ossrh` repository.
52+
# The `OSSRH_USERNAME` environment variable will be set with the contents of your `OSSRH_USERNAME` secret,
53+
# and the `OSSRH_TOKEN` environment variable will be set with the contents of your `OSSRH_TOKEN` secret.
54+
- name: Build, analyze and publish package
55+
env:
56+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
57+
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
58+
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
60+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
61+
run: ./mvnw --batch-mode deploy org.sonarsource.scanner.maven:sonar-maven-plugin:RELEASE:sonar -Pmaven-central-publishing

‎.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ buildNumber.properties
1515
.project
1616
# JDT-specific (Eclipse Java Development Tools)
1717
.classpath
18+
/.git-versioned-pom.xml
19+
/.polyglot.pom.yml

‎.java-version

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

‎.mvn/extensions.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<extensions>
3+
<extension>
4+
<groupId>io.takari.polyglot</groupId>
5+
<artifactId>polyglot-yaml</artifactId>
6+
<version>0.7.0</version>
7+
</extension>
8+
<extension>
9+
<groupId>me.qoomon</groupId>
10+
<artifactId>maven-git-versioning-extension</artifactId>
11+
<version>9.8.1</version>
12+
</extension>
13+
</extensions>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://github.com/qoomon/maven-git-versioning-extension" xsi:schemaLocation="https://github.com/qoomon/maven-git-versioning-extension https://qoomon.github.io/maven-git-versioning-extension/configuration-7.0.0.xsd">
2+
<refs>
3+
<ref type="branch">
4+
<pattern>.+</pattern>
5+
<version>${ref}-SNAPSHOT</version>
6+
</ref>
7+
8+
<ref type="tag">
9+
<pattern><![CDATA[^v?(?<version>\d+\.\d+\.\d+.*)$]]></pattern>
10+
<version>${ref.version}</version>
11+
</ref>
12+
</refs>
13+
14+
<!-- optional fallback configuration in case of no matching ref configuration-->
15+
<rev>
16+
<version>${commit}</version>
17+
</rev>
18+
</configuration>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
wrapperVersion=3.3.2
18+
distributionType=only-script
19+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip

0 commit comments

Comments
 (0)