Skip to content

Commit f6942bd

Browse files
author
erict875
committed
Merge remote-tracking branch 'origin/develop'
# Conflicts: # buildSrc/build.gradle # gradle.properties # nostr-java-api/pom.xml # nostr-java-base/pom.xml # nostr-java-client/pom.xml # nostr-java-crypto/pom.xml # nostr-java-encryption/pom.xml # nostr-java-event/pom.xml # nostr-java-examples/pom.xml # nostr-java-id/pom.xml # nostr-java-util/pom.xml # pom.xml
2 parents 7b90fb3 + fa5f776 commit f6942bd

240 files changed

Lines changed: 2154 additions & 2008 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "maven"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
open-pull-requests-limit: 10
8+
- package-ecosystem: "github-actions"
9+
directory: "/"
10+
schedule:
11+
interval: "weekly"
12+
open-pull-requests-limit: 10

.github/labeler.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
bug:
2+
- '(?i)\bbug\b'
3+
feature:
4+
- '(?i)\bfeature\b'
5+
question:
6+
- '(?i)\bquestion\b'

.github/workflows/ci.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main, develop]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: actions/setup-java@v4
15+
with:
16+
java-version: '21'
17+
distribution: 'temurin'
18+
cache: 'maven'
19+
- name: Build with Maven
20+
run: ./mvnw -q verify
21+
- name: Upload surefire reports
22+
if: always()
23+
uses: actions/upload-artifact@v4
24+
with:
25+
name: surefire-reports
26+
path: '**/target/surefire-reports'
27+
if-no-files-found: ignore
28+
- name: Upload JaCoCo coverage
29+
if: always()
30+
uses: actions/upload-artifact@v4
31+
with:
32+
name: jacoco-exec
33+
path: '**/target/jacoco.exec'
34+
if-no-files-found: ignore
35+
- name: Upload coverage to Codecov
36+
uses: codecov/codecov-action@v5
37+
with:
38+
files: '**/target/site/jacoco/jacoco.xml'
39+
token: ${{ secrets.CODECOV_TOKEN }}
40+
- name: Upload test results to Codecov
41+
if: ${{ !cancelled() }}
42+
uses: codecov/test-results-action@v1
43+
with:
44+
token: ${{ secrets.CODECOV_TOKEN }}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: CodeQL
2+
3+
# Disable GitHub's default CodeQL setup in the repository settings to avoid
4+
# "advanced configuration" errors when using this workflow.
5+
6+
on:
7+
push:
8+
branches: [main, develop]
9+
pull_request:
10+
branches: [main, develop]
11+
12+
jobs:
13+
analyze:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
actions: read
17+
contents: read
18+
security-events: write
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: actions/setup-java@v4
22+
with:
23+
distribution: temurin
24+
java-version: '21'
25+
- uses: github/codeql-action/init@v3
26+
with:
27+
languages: 'java'
28+
- uses: github/codeql-action/autobuild@v3
29+
- uses: github/codeql-action/analyze@v3
30+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Issue Labeler
2+
3+
on:
4+
issues:
5+
types: [opened]
6+
7+
permissions:
8+
issues: write
9+
contents: read
10+
11+
jobs:
12+
triage:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: github/issue-labeler@v3
16+
with:
17+
configuration-path: .github/labeler.yml
18+
include-title: 1
19+
repo-token: ${{ github.token }}

.github/workflows/release.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v4
14+
15+
- name: Set up JDK 21
16+
uses: actions/setup-java@v4
17+
with:
18+
distribution: 'temurin'
19+
java-version: '21'
20+
cache: 'maven'
21+
server-id: github
22+
server-username: ${{ github.actor }}
23+
server-password: ${{ secrets.GITHUB_TOKEN }}
24+
25+
- name: Import GPG key
26+
env:
27+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
28+
run: |
29+
echo "$GPG_PRIVATE_KEY" | gpg --batch --import
30+
gpg --list-secret-keys --keyid-format LONG
31+
32+
- name: Build and deploy
33+
env:
34+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
35+
run: ./mvnw -q -P release deploy -Dgpg.passphrase="$GPG_PASSPHRASE"
36+
37+
- name: Deploy to GitHub Packages
38+
env:
39+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
40+
run: |
41+
./mvnw -q -P release deploy -Dgpg.passphrase="$GPG_PASSPHRASE" \
42+
-DaltDeploymentRepository=github::default::https://maven.pkg.github.com/tcheeric/nostr-java
43+
44+
- name: Collect JAR artifacts
45+
run: |
46+
mkdir -p release-jars
47+
find . -name "*.jar" -path "*/target/*.jar" -not -name "*sources*" -not -name "*javadoc*" -exec cp {} release-jars/ \;
48+
if ! ls release-jars/*.jar 1> /dev/null 2>&1; then
49+
echo "Error: No JAR files found to upload."
50+
exit 1
51+
fi
52+
53+
- name: Create GitHub release
54+
id: create_release
55+
uses: actions/create-release@v1
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
with:
59+
tag_name: ${{ github.ref }}
60+
release_name: ${{ github.ref_name }}
61+
draft: false
62+
env:
63+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
run: |
65+
gh release create "${{ github.ref_name }}" \
66+
--title "${{ github.ref }}" \
67+
--notes "" \
68+
--verify-tag \
69+
--latest
70+
71+
- name: Upload JAR artifacts
72+
env:
73+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74+
run: |
75+
for file in release-jars/*.jar; do
76+
gh release upload "${{ github.ref_name }}" "$file" --clobber
77+
done

.github/workflows/stale.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Close Stale Issues and PRs
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * *'
6+
workflow_dispatch:
7+
8+
permissions:
9+
issues: write
10+
pull-requests: write
11+
12+
jobs:
13+
stale:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/stale@v9
17+
with:
18+
repo-token: ${{ secrets.GITHUB_TOKEN }}
19+
days-before-stale: 30
20+
days-before-close: 7
21+
exempt-issue-labels: pinned,security
22+
exempt-pr-labels: pinned,security
23+
stale-issue-label: stale
24+
stale-pr-label: stale
25+
stale-issue-message: >-
26+
This issue has been automatically marked as stale because it has not had recent activity.
27+
It will be closed if no further activity occurs.
28+
stale-pr-message: >-
29+
This pull request has been automatically marked as stale because it has not had recent activity.
30+
It will be closed if no further activity occurs.
31+
close-issue-message: >-
32+
Closing this issue due to prolonged inactivity.
33+
close-pr-message: >-
34+
Closing this pull request due to prolonged inactivity.

.gitignore

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ build/
3131
nbbuild/
3232
dist/
3333
nbdist/
34-
.nb-gradle/
35-
3634
# External tool builders
3735
.externalToolBuilders/
3836

@@ -123,12 +121,8 @@ nb-configuration.xml
123121
.idea/**/uiDesigner.xml
124122
.idea/**/dbnavigator.xml
125123

126-
# Gradle
127-
.idea/**/gradle.xml
128-
.idea/**/libraries
129-
130-
# Gradle and Maven with auto-import
131-
# When using Gradle or Maven with auto-import, you should exclude module files,
124+
# Maven with auto-import
125+
# When using Maven with auto-import, you should exclude module files,
132126
# since they will be recreated, and may cause churn. Uncomment if using
133127
# auto-import.
134128
# .idea/modules.xml
@@ -211,13 +205,6 @@ hs_err_pid*
211205
## ignoring target file
212206
target/
213207

214-
# Gradle files
215-
.gradle/
216-
#gradle/
217-
#gradlew
218-
#gradlew.bat
219-
buildSrc/build
220-
221208
### VisualStudioCode ###
222209
.vscode
223210
.vscode/*

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
# nostr-java
2+
[![CI](https://github.com/tcheeric/nostr-java/actions/workflows/ci.yml/badge.svg)](https://github.com/tcheeric/nostr-java/actions/workflows/ci.yml)
3+
[![codecov](https://codecov.io/gh/tcheeric/nostr-java/branch/main/graph/badge.svg)](https://codecov.io/gh/tcheeric/nostr-java)
4+
[![GitHub release](https://img.shields.io/github/v/release/tcheeric/nostr-java)](https://github.com/tcheeric/nostr-java/releases)
5+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
26

37
`nostr-java` is a Java SDK for the [Nostr](https://github.com/nostr-protocol/nips) protocol. It provides utilities for creating, signing and publishing Nostr events to relays.
48

@@ -17,9 +21,34 @@ $ ./mvnw clean install
1721

1822
See [`docs/CODEBASE_OVERVIEW.md`](docs/CODEBASE_OVERVIEW.md) for details about running tests and contributing.
1923

24+
## Using Published Artifacts
25+
Artifacts are published to GitHub Packages and can be consumed from Maven by adding the repository and desired dependency to your `pom.xml`:
26+
27+
```xml
28+
<repositories>
29+
<repository>
30+
<id>github</id>
31+
<url>https://maven.pkg.github.com/OWNER/REPO</url>
32+
</repository>
33+
</repositories>
34+
35+
<dependencies>
36+
<dependency>
37+
<groupId>xyz.tcheeric</groupId>
38+
<artifactId>nostr-java-api</artifactId>
39+
<version>${nostr-java.version}</version>
40+
</dependency>
41+
</dependencies>
42+
```
43+
44+
Authenticating to GitHub Packages is required; provide a personal access token with the appropriate scopes or `GITHUB_TOKEN` credentials. See the [GitHub Packages documentation](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-apache-maven-registry) for more details.
45+
2046
## Examples
2147
Example usages are located in the [`nostr-java-examples`](./nostr-java-examples) module. Additional demonstrations can be found in [nostr-client](https://github.com/tcheeric/nostr-client) and [SuperConductor](https://github.com/avlo/superconductor).
2248

49+
## Retry Support
50+
`SpringWebSocketClient` leverages Spring Retry so that failed WebSocket send operations are attempted up to three times with exponential backoff.
51+
2352
## Supported NIPs
2453
The API currently implements the following [NIPs](https://github.com/nostr-protocol/nips):
2554
- [NIP-1](https://github.com/nostr-protocol/nips/blob/master/01.md)

buildSrc/build.gradle

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

0 commit comments

Comments
 (0)