Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
8631c98
Update POM file for NotificationAPI Java Server SDK to include projec…
mbasadi Apr 12, 2025
bdd142d
Add Maven Central sync and artifact verification to GitHub Actions wo…
mbasadi Apr 12, 2025
cf0e654
Add dependencies for JSON processing and HTTP client in POM file
mbasadi Apr 12, 2025
c38e25c
Add .gitignore file to exclude build artifacts, IDE files, and OS-spe…
mbasadi Apr 12, 2025
b203ae4
Add Checkstyle configuration and integrate with Maven build process
mbasadi Apr 12, 2025
17a6ef0
Add GPG configuration for signing in GitHub Actions workflow
mbasadi Apr 12, 2025
e181cba
Update GPG configuration in GitHub Actions workflow for enhanced secu…
mbasadi Apr 12, 2025
7028851
Remove GPG configuration steps from GitHub Actions workflow
mbasadi Apr 12, 2025
8ed759b
Update GPG configuration in GitHub Actions workflow to use secrets
mbasadi Apr 12, 2025
f623abe
Update SNAPSHOT deployment in GitHub Actions workflow to use secrets …
mbasadi Apr 12, 2025
2b0ae8f
Merge branch 'main' into XCJnCBZS/3159-create-a-java-sdk
mbasadi Apr 12, 2025
d0e9308
Update GitHub Actions workflow to change server ID and streamline dep…
mbasadi Apr 12, 2025
f3211fc
Enhance GitHub Actions workflow for SNAPSHOT deployment with secure c…
mbasadi Apr 12, 2025
fa34285
Refactor SNAPSHOT deployment step in GitHub Actions workflow for clarity
mbasadi Apr 12, 2025
51a1986
Update SNAPSHOT deployment command in GitHub Actions workflow to use …
mbasadi Apr 12, 2025
5653df0
Update SNAPSHOT deployment command to include GPG passphrase from sec…
mbasadi Apr 12, 2025
54548bf
Refactor GitHub Actions workflow for SNAPSHOT deployment to enhance s…
mbasadi Apr 12, 2025
dba34e7
Update Maven settings file path in GitHub Actions workflow for SNAPSH…
mbasadi Apr 12, 2025
8b55558
Update pom.xml and GitHub Actions workflow for improved deployment an…
mbasadi Apr 13, 2025
e61e048
Remove the release profile from the Maven deploy command in GitHub Ac…
mbasadi Apr 13, 2025
a8316e9
Update GitHub Actions workflow to include GPG key import and passphra…
mbasadi Apr 13, 2025
423a9cf
Enhance GitHub Actions workflow by configuring GPG for non-interactiv…
mbasadi Apr 13, 2025
05456c0
Refactor GPG key handling in GitHub Actions workflow for Maven deploy…
mbasadi Apr 13, 2025
7d5cf4a
Add distribution management and release profile to pom.xml for Maven …
mbasadi Apr 13, 2025
4413a0e
Remove unused distribution management and release profile sections fr…
mbasadi Apr 13, 2025
368b4e9
Refactor GitHub Actions workflow for Pull Request CI by renaming the …
mbasadi Apr 13, 2025
a8fd707
Update pom.xml to set Java compiler properties for version 17 and UTF…
mbasadi Apr 13, 2025
f810a7e
Enhance GitHub Actions workflow for Pull Request CI by adding an ID f…
mbasadi Apr 13, 2025
7c90c8f
Update GitHub Actions workflow to use the GPG key ID from the import …
mbasadi Apr 13, 2025
4e74ee7
Update GitHub Actions workflow to use GPG key name from secrets for M…
mbasadi Apr 13, 2025
a3abad5
Update GitHub Actions workflow to utilize the GPG key ID from the imp…
mbasadi Apr 13, 2025
c71e091
Update version in pom.xml to 0.1.3 and add GitHub Actions workflow fo…
mbasadi Apr 13, 2025
22ddcbd
Add pull request trigger to GitHub Actions workflow for Maven publishing
mbasadi Apr 13, 2025
99e4f84
Refactor GitHub Actions workflow for Maven publishing by removing red…
mbasadi Apr 13, 2025
5a9b28b
Enhance GitHub Actions workflow for Maven publishing by configuring G…
mbasadi Apr 13, 2025
743afe8
Refactor GitHub Actions workflow for Maven publishing by improving GP…
mbasadi Apr 13, 2025
b541185
Update GitHub Actions workflow for Maven publishing to explicitly use…
mbasadi Apr 13, 2025
21e5906
Update GitHub Actions workflow for Maven publishing to use GPG key na…
mbasadi Apr 13, 2025
673e64a
last
mbasadi Apr 13, 2025
0940312
Update version in pom.xml to 0.1.5 and modify GitHub Actions workflow…
mbasadi Apr 13, 2025
d2f601c
Enhance GitHub Actions workflow for Maven publishing by adding a debu…
mbasadi Apr 13, 2025
f924568
Update version in pom.xml to 0.1.9, add settings.xml for Maven server…
mbasadi Apr 14, 2025
e786b1f
Update GitHub Actions workflow to include GPG key name in environment…
mbasadi Apr 14, 2025
4c1ac3d
Add GPG key import step to GitHub Actions workflow for Maven deployme…
mbasadi Apr 14, 2025
1c44a68
Refactor GPG key import process in GitHub Actions workflow by creatin…
mbasadi Apr 14, 2025
133abda
remove signing
mbasadi Apr 14, 2025
3760d54
Add GPG signing configuration to pom.xml and update GitHub Actions wo…
mbasadi Apr 14, 2025
d5888f7
Adding verification that the key is properly imported before trying t…
mbasadi Apr 14, 2025
2dbc422
Refactor GPG key handling in GitHub Actions workflow to extract and u…
mbasadi Apr 14, 2025
02b9b04
Add central profile to Maven settings in GitHub Actions workflow for …
mbasadi Apr 14, 2025
d752dd0
Update version to 0.1.10 in pom.xml and modify GitHub Actions workflo…
mbasadi Apr 14, 2025
bd0ff09
Update version to 0.1.11 in pom.xml to reflect the latest release.
mbasadi Apr 14, 2025
5a3910b
Update version to 0.1.12 in pom.xml and modify GitHub Actions workflo…
mbasadi Apr 14, 2025
bda2043
Update Maven compiler source and target versions to 11 in pom.xml, al…
mbasadi Apr 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
153 changes: 85 additions & 68 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,84 +3,101 @@ name: Publish Package
on:
push:
branches: [ main ]
release:
types: [created]

jobs:
publish:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up JDK 11

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'
cache: 'maven'
server-id: github
settings-path: ${{ github.workspace }}
cache: maven

- name: Notify Build Start
uses: 8398a7/action-slack@v3
with:
status: custom
fields: repo,message,commit,workflow
custom_payload: |
{
"text": "🚀 Starting build and publish for notificationapi-java-server-sdk",
"attachments": [{
"color": "good",
"fields": [
{
"title": "Repository",
"value": "{repo}",
"short": true
},
{
"title": "Commit",
"value": "{commit}",
"short": true
}
]
}]
}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
- name: Import GPG key
run: |
# Setup GPG directory
mkdir -p ~/.gnupg
chmod 700 ~/.gnupg

- name: Build with Maven
run: mvn -B package --file pom.xml

- name: Run tests
run: mvn -B test --file pom.xml

- name: Check code style
run: mvn -B checkstyle:check --file pom.xml

- name: Generate Javadoc
run: mvn -B javadoc:javadoc --file pom.xml

- name: Publish to GitHub Packages
run: mvn --batch-mode deploy
env:
GITHUB_TOKEN: ${{ secrets.PACKAGES_TOKEN }}

- name: Notify Success
if: success()
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: repo,message,commit,workflow,took
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_SUCCESS_WEBHOOK_URL }}
# Write key to file
echo "${{ secrets.GPG_PRIVATE_KEY }}" > ~/private.key

# Import the key
gpg --batch --import ~/private.key

# Clean up
rm ~/private.key

# Extract key ID from the imported key
GPG_KEY_ID=$(gpg --list-secret-keys --keyid-format LONG | grep sec | awk '{print $2}' | cut -d'/' -f2)
echo "Imported GPG key ID: $GPG_KEY_ID"
echo "GPG_KEY_ID=$GPG_KEY_ID" >> $GITHUB_ENV

- name: Notify Failure
if: failure()
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: repo,message,commit,workflow,took
- name: Build and Publish with Maven
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_FAILED_WEBHOOK_URL }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: |
# Create settings.xml file
mkdir -p ~/.m2
cat > ~/.m2/settings.xml << EOF
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>central</id>
<username>\${env.OSSRH_USERNAME}</username>
<password>\${env.OSSRH_TOKEN}</password>
</server>
<server>
<id>gpg.passphrase</id>
<passphrase>\${env.GPG_PASSPHRASE}</passphrase>
</server>
</servers>
<profiles>
<profile>
<id>gpg</id>
<properties>
<gpg.keyname>\${env.GPG_KEY_ID}</gpg.keyname>
<gpg.passphrase>\${env.GPG_PASSPHRASE}</gpg.passphrase>
<gpg.executable>gpg</gpg.executable>
</properties>
</profile>
<profile>
<id>central</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<central.username>\${env.OSSRH_USERNAME}</central.username>
<central.password>\${env.OSSRH_TOKEN}</central.password>
</properties>
</profile>
</profiles>
<activeProfiles>
<activeProfile>gpg</activeProfile>
<activeProfile>central</activeProfile>
</activeProfiles>
</settings>
EOF

# Debug GPG configuration
echo "Using GPG key ID: $GPG_KEY_ID"
gpg --list-keys $GPG_KEY_ID

# Set environment variables and run Maven with debug for GPG
export OSSRH_USERNAME=${{ secrets.OSSRH_USERNAME }}
export OSSRH_TOKEN="${{ secrets.OSSRH_TOKEN }}"
export GPG_PASSPHRASE=${{ secrets.GPG_PASSPHRASE }}

mvn clean deploy -Dgpg.keyname=$GPG_KEY_ID -Dgpg.passphrase=$GPG_PASSPHRASE -Dcentral.username=$OSSRH_USERNAME -Dcentral.password=$OSSRH_TOKEN --settings ~/.m2/settings.xml
9 changes: 8 additions & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ jobs:
java-version: ${{ matrix.java }}
distribution: 'temurin'
cache: 'maven'
server-id: central
server-username: ${{ secrets.OSSRH_USERNAME }}
server-password: ${{ secrets.OSSRH_TOKEN }}
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
settings-path: ${{ github.workspace }}

- name: Build with Maven
run: mvn -B package --file pom.xml
Expand All @@ -31,4 +37,5 @@ jobs:
run: mvn -B checkstyle:check --file pom.xml

- name: Generate Javadoc
run: mvn -B javadoc:javadoc --file pom.xml
run: mvn -B javadoc:javadoc --file pom.xml

35 changes: 35 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Maven
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
.mvn/wrapper/maven-wrapper.jar

# IDE files
.idea/
*.iml
.vscode/
.project
.classpath
.settings/

# Compiled files
*.class
*.jar
*.war
*.ear
*.zip
*.tar.gz
*.rar

# Logs
*.log

# OS specific
.DS_Store
Thumbs.db
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This is the official Java Server SDK for [NotificationAPI](https://www.notificat

## Installation

Add the following dependency to your `pom.xml` file:
Add the following dependency to your project's `pom.xml`:

```xml
<dependency>
Expand Down Expand Up @@ -82,7 +82,3 @@ try (NotificationApi api = new NotificationApi(clientId, clientSecret)) {

- Java 11 or later
- Maven or Gradle build system

## License

This project is licensed under the MIT License - see the LICENSE file for details.
91 changes: 91 additions & 0 deletions checkstyle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">

<module name="Checker">
<property name="charset" value="UTF-8"/>
<property name="severity" value="warning"/>
<property name="fileExtensions" value="java"/>

<!-- Excludes all 'module-info.java' files -->
<module name="BeforeExecutionExclusionFileFilter">
<property name="fileNamePattern" value="module\-info\.java$"/>
</module>

<!-- Checks for whitespace -->
<module name="FileTabCharacter">
<property name="eachLine" value="true"/>
</module>

<module name="LineLength">
<property name="max" value="120"/>
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
</module>

<module name="TreeWalker">
<!-- Import checks -->
<module name="AvoidStarImport"/>
<module name="IllegalImport"/>
<module name="RedundantImport"/>
<module name="UnusedImports"/>

<!-- Checks for Naming Conventions -->
<module name="ConstantName"/>
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>
<module name="MemberName"/>
<module name="MethodName"/>
<module name="PackageName"/>
<module name="ParameterName"/>
<module name="StaticVariableName"/>
<module name="TypeName"/>

<!-- Checks for Size Violations -->
<module name="MethodLength"/>
<module name="ParameterNumber"/>

<!-- Checks for whitespace -->
<module name="EmptyForIteratorPad"/>
<module name="GenericWhitespace"/>
<module name="MethodParamPad"/>
<module name="NoWhitespaceAfter"/>
<module name="NoWhitespaceBefore"/>
<module name="OperatorWrap"/>
<module name="ParenPad"/>
<module name="TypecastParenPad"/>
<module name="WhitespaceAfter"/>
<module name="WhitespaceAround"/>

<!-- Modifier Checks -->
<module name="ModifierOrder"/>
<module name="RedundantModifier"/>

<!-- Checks for blocks -->
<module name="AvoidNestedBlocks"/>
<module name="EmptyBlock"/>
<module name="LeftCurly"/>
<module name="NeedBraces"/>
<module name="RightCurly"/>

<!-- Checks for common coding problems -->
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
<module name="IllegalInstantiation"/>
<module name="InnerAssignment"/>
<module name="MissingSwitchDefault"/>
<module name="MultipleVariableDeclarations"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>

<!-- Checks for class design -->
<module name="FinalClass"/>
<module name="InterfaceIsType"/>
<module name="VisibilityModifier"/>

<!-- Miscellaneous other checks -->
<module name="ArrayTypeStyle"/>
<module name="TodoComment"/>
<module name="UpperEll"/>
</module>
</module>
Loading