mirror of
https://github.com/CarmJos/GithubReleases4J.git
synced 2026-06-04 21:18:16 +08:00
Compare commits
53 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 332d62f62c | |||
| 4c4ef7e821 | |||
| abf50f1dfe | |||
| 5121d84302 | |||
| d88606462b | |||
| 94836b8e89 | |||
| 2cec16a726 | |||
| ffe1ad97d9 | |||
| 9486a602a3 | |||
| ac1059c442 | |||
| 5ae0ce72fd | |||
| 2fda505604 | |||
| 7ba85e192c | |||
| fc3d8300de | |||
| a69e72fea6 | |||
| 1cdd74b2f1 | |||
| 019afcadfe | |||
| 057f982c1f | |||
| fc596a6a4a | |||
| 0c08de0aec | |||
| 4ee060f789 | |||
| 6627666e92 | |||
| 9291d2747a | |||
| 153a5c8eec | |||
| 2916abf578 | |||
| ddc2dba6f4 | |||
| 491594482b | |||
| 73746bc7f2 | |||
| 9bcf525bf4 | |||
| 1f090a1a92 | |||
| 50d3848da4 | |||
| 35d8369ea0 | |||
| c10a2526d6 | |||
| c5de7720bb | |||
| 21865afef0 | |||
| 7d0698e75d | |||
| da9aaa6b97 | |||
| b24a513af1 | |||
| ba156d7923 | |||
| 3d2d3e0799 | |||
| 162249e095 | |||
| e020c07749 | |||
| 6d688fb5c4 | |||
| 5096003228 | |||
| b60283a9c2 | |||
| 4cc891edc0 | |||
| 8bf0d98c00 | |||
| df72460044 | |||
| 81f621b0a6 | |||
| 6f8452bed8 | |||
| 3b787b8c0f | |||
| a6ab32a762 | |||
| 2cad1116b9 |
@@ -0,0 +1,41 @@
|
|||||||
|
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||||
|
|
||||||
|
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
|
||||||
|
OK7d0W/LdJ3iFeselROADHgPQn14sg==
|
||||||
|
=rRA5
|
||||||
|
-----END PGP PUBLIC KEY BLOCK-----
|
||||||
@@ -38,11 +38,11 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
# Initializes the CodeQL tools for scanning.
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v1
|
uses: github/codeql-action/init@v4
|
||||||
with:
|
with:
|
||||||
languages: ${{ matrix.language }}
|
languages: ${{ matrix.language }}
|
||||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||||
@@ -53,7 +53,7 @@ jobs:
|
|||||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||||
# If this step fails, then you should remove it and run the build manually (see below)
|
# If this step fails, then you should remove it and run the build manually (see below)
|
||||||
- name: Autobuild
|
- name: Autobuild
|
||||||
uses: github/codeql-action/autobuild@v1
|
uses: github/codeql-action/autobuild@v4
|
||||||
|
|
||||||
# ℹ️ Command-line programs to run using the OS shell.
|
# ℹ️ Command-line programs to run using the OS shell.
|
||||||
# 📚 https://git.io/JvXDl
|
# 📚 https://git.io/JvXDl
|
||||||
@@ -67,4 +67,4 @@ jobs:
|
|||||||
# make release
|
# make release
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@v1
|
uses: github/codeql-action/analyze@v4
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
|
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
|
||||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
|
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
|
||||||
|
|
||||||
name: Deploy & Upload
|
name: "Deploy & Upload"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
# 支持手动触发构建
|
# 支持手动触发构建
|
||||||
@@ -11,14 +11,14 @@ on:
|
|||||||
types: [ published ]
|
types: [ published ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
gh-deploy:
|
||||||
|
name: "Publish Project (GitHub)"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v6
|
||||||
- name: "Set up JDK"
|
- name: "Set up JDK"
|
||||||
uses: actions/setup-java@v2
|
uses: actions/setup-java@v5
|
||||||
with:
|
with:
|
||||||
java-version: '11'
|
java-version: '11'
|
||||||
distribution: 'adopt'
|
distribution: 'adopt'
|
||||||
@@ -29,14 +29,14 @@ jobs:
|
|||||||
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
|
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
|
||||||
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
|
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
|
||||||
|
|
||||||
- name: "Maven Deploy"
|
- name: "Maven Deploy With Javadoc"
|
||||||
run: mvn -B deploy --file pom.xml -DskipTests
|
run: mvn -B -Pgithub deploy --file pom.xml -DskipTests
|
||||||
env:
|
env:
|
||||||
MAVEN_USERNAME: ${{ github.repository_owner }}
|
MAVEN_USERNAME: ${{ github.repository_owner }}
|
||||||
MAVEN_TOKEN: ${{secrets.GITHUB_TOKEN}} # env variable for gpg signing in deploy
|
MAVEN_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
||||||
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
|
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
|
||||||
|
|
||||||
- name: "Javadoc Deploy Staging"
|
- name: "Copy Javadoc to Location"
|
||||||
run: |
|
run: |
|
||||||
rm -rf docs
|
rm -rf docs
|
||||||
mkdir -vp docs
|
mkdir -vp docs
|
||||||
@@ -47,10 +47,10 @@ jobs:
|
|||||||
id: sitemap
|
id: sitemap
|
||||||
uses: cicirello/generate-sitemap@v1
|
uses: cicirello/generate-sitemap@v1
|
||||||
with:
|
with:
|
||||||
base-url-path: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}
|
base-url-path: https://carmjos.github.io/GithubReleases4J
|
||||||
path-to-root: docs
|
path-to-root: docs
|
||||||
|
|
||||||
- name: "Output Javadoc stats"
|
- name: "Output stats"
|
||||||
run: |
|
run: |
|
||||||
echo "sitemap-path = ${{ steps.sitemap.outputs.sitemap-path }}"
|
echo "sitemap-path = ${{ steps.sitemap.outputs.sitemap-path }}"
|
||||||
echo "url-count = ${{ steps.sitemap.outputs.url-count }}"
|
echo "url-count = ${{ steps.sitemap.outputs.url-count }}"
|
||||||
@@ -68,11 +68,11 @@ jobs:
|
|||||||
git config --global user.name 'CarmJos'
|
git config --global user.name 'CarmJos'
|
||||||
git config --global user.email 'carm@carm.cc'
|
git config --global user.email 'carm@carm.cc'
|
||||||
|
|
||||||
- name: "Commit Javadocs"
|
- name: "Commit documentations"
|
||||||
run: |
|
run: |
|
||||||
cd docs
|
cd docs
|
||||||
git init
|
git init
|
||||||
git remote add origin git@github.com:${{ github.repository }}.git
|
git remote add origin git@github.com:CarmJos/GithubReleases4J.git
|
||||||
git checkout -b gh-pages
|
git checkout -b gh-pages
|
||||||
git add -A
|
git add -A
|
||||||
git commit -m "API Document generated."
|
git commit -m "API Document generated."
|
||||||
@@ -80,4 +80,29 @@ jobs:
|
|||||||
- name: "Push javadocs"
|
- name: "Push javadocs"
|
||||||
run: |
|
run: |
|
||||||
cd docs
|
cd docs
|
||||||
git push origin HEAD:gh-pages --force
|
git push origin HEAD:gh-pages --force
|
||||||
|
|
||||||
|
central-deploy:
|
||||||
|
name: "Deploy Project (Central)"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
- name: "Set up JDK"
|
||||||
|
uses: actions/setup-java@v5
|
||||||
|
with:
|
||||||
|
java-version: '11'
|
||||||
|
distribution: 'adopt'
|
||||||
|
cache: maven
|
||||||
|
server-id: ossrh
|
||||||
|
server-username: MAVEN_USERNAME
|
||||||
|
server-password: MAVEN_PASSWORD
|
||||||
|
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
|
||||||
|
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
|
||||||
|
|
||||||
|
- name: "Central Deploy"
|
||||||
|
run: mvn -B -Possrh deploy --file pom.xml -DskipTests
|
||||||
|
env:
|
||||||
|
MAVEN_USERNAME: ${{ secrets.OSSRH_USER }}
|
||||||
|
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASS }}
|
||||||
|
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
|
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
|
||||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
|
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
|
||||||
|
|
||||||
name: Project Build & Tests
|
name: Build & Tests
|
||||||
|
|
||||||
on:
|
on:
|
||||||
# 支持手动触发构建
|
# 支持手动触发构建
|
||||||
@@ -14,9 +14,9 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v6
|
||||||
- name: "Set up JDK"
|
- name: "Set up JDK"
|
||||||
uses: actions/setup-java@v2
|
uses: actions/setup-java@v5
|
||||||
with:
|
with:
|
||||||
java-version: '11'
|
java-version: '11'
|
||||||
distribution: 'adopt'
|
distribution: 'adopt'
|
||||||
@@ -32,7 +32,7 @@ jobs:
|
|||||||
- name: "Target Stage"
|
- name: "Target Stage"
|
||||||
run: mkdir staging && cp target/*.jar staging
|
run: mkdir staging && cp target/*.jar staging
|
||||||
- name: "Upload artifact"
|
- name: "Upload artifact"
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v7
|
||||||
with:
|
with:
|
||||||
name: Artifact
|
name: Artifact
|
||||||
path: staging
|
path: staging
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ README LANGUAGES [ [**ENGLISH**](README.md) | [中文](README_zh_CN.md) ]
|
|||||||
[](https://opensource.org/licenses/GPL-3.0)
|
[](https://opensource.org/licenses/GPL-3.0)
|
||||||
[](https://github.com/CarmJos/GithubReleases4J/actions/workflows/maven.yml)
|
[](https://github.com/CarmJos/GithubReleases4J/actions/workflows/maven.yml)
|
||||||

|

|
||||||

|
|
||||||

|

|
||||||
|
|
||||||
GitHub Releases for Java , based on [GitHub REST API](https://docs.github.com/cn/rest/reference/releases) .
|
GitHub Releases for Java , based on [GitHub REST API](https://docs.github.com/cn/rest/reference/releases) .
|
||||||
@@ -39,6 +38,7 @@ To provide an easy way to fetch updates and download assets.
|
|||||||
- Size
|
- Size
|
||||||
- ...
|
- ...
|
||||||
- Release's Assets Download
|
- Release's Assets Download
|
||||||
|
- Update check methods. (See demo)
|
||||||
|
|
||||||
## Dependency Usage
|
## Dependency Usage
|
||||||
|
|
||||||
@@ -49,21 +49,32 @@ To provide an easy way to fetch updates and download assets.
|
|||||||
|
|
||||||
<project>
|
<project>
|
||||||
<repositories>
|
<repositories>
|
||||||
|
|
||||||
|
<repository>
|
||||||
|
<!--Using central repository-->
|
||||||
|
<id>maven</id>
|
||||||
|
<name>Maven Central</name>
|
||||||
|
<url>https://repo1.maven.org/maven2</url>
|
||||||
|
</repository>
|
||||||
|
|
||||||
<repository>
|
<repository>
|
||||||
<!--Using github packages-->
|
<!--Using github packages-->
|
||||||
<id>GithubReleases4J</id>
|
<id>GithubReleases4J</id>
|
||||||
<name>GitHub Packages</name>
|
<name>GitHub Packages</name>
|
||||||
<url>https://maven.pkg.github.com/CarmJos/GithubReleases4J</url>
|
<url>https://maven.pkg.github.com/CarmJos/GithubReleases4J</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<artifactId>githubreleases4j</artifactId>
|
<artifactId>githubreleases4j</artifactId>
|
||||||
<version>[LATEST RELEASE]</version>
|
<version>[LATEST RELEASE]</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
@@ -76,6 +87,9 @@ To provide an easy way to fetch updates and download assets.
|
|||||||
|
|
||||||
```groovy
|
```groovy
|
||||||
repositories {
|
repositories {
|
||||||
|
|
||||||
|
mavenCentral() // Using central repository.
|
||||||
|
|
||||||
// Using github packages.
|
// Using github packages.
|
||||||
maven { url 'https://maven.pkg.github.com/CarmJos/GithubReleases4J' }
|
maven { url 'https://maven.pkg.github.com/CarmJos/GithubReleases4J' }
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-2
@@ -41,27 +41,39 @@ GitHub Releases for Java , 基于 [GitHub REST API](https://docs.github.com/cn/r
|
|||||||
|
|
||||||
<project>
|
<project>
|
||||||
<repositories>
|
<repositories>
|
||||||
|
|
||||||
|
<repository>
|
||||||
|
<!--采用Maven中心库,安全稳定,但版本更新需要等待同步-->
|
||||||
|
<id>maven</id>
|
||||||
|
<name>Maven Central</name>
|
||||||
|
<url>https://repo1.maven.org/maven2</url>
|
||||||
|
</repository>
|
||||||
|
|
||||||
<repository>
|
<repository>
|
||||||
<!--采用github依赖库,安全稳定,但需要配置 (推荐)-->
|
<!--采用github依赖库,安全稳定,但需要配置 (推荐)-->
|
||||||
<id>GithubReleases4J</id>
|
<id>GithubReleases4J</id>
|
||||||
<name>GitHub Packages</name>
|
<name>GitHub Packages</name>
|
||||||
<url>https://maven.pkg.github.com/CarmJos/GithubReleases4J</url>
|
<url>https://maven.pkg.github.com/CarmJos/GithubReleases4J</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
|
||||||
<repository>
|
<repository>
|
||||||
<!--采用我的私人依赖库,简单方便,但可能因为变故而无法使用-->
|
<!--采用我的私人依赖库,简单方便,但可能因为变故而无法使用-->
|
||||||
<id>carm-repo</id>
|
<id>carm-repo</id>
|
||||||
<name>Carm's Repo</name>
|
<name>Carm's Repo</name>
|
||||||
<url>https://repo.carm.cc/repository/maven-public/</url>
|
<url>https://repo.carm.cc/repository/maven-public/</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<artifactId>githubreleases4j</artifactId>
|
<artifactId>githubreleases4j</artifactId>
|
||||||
<version>[LATEST RELEASE]</version>
|
<version>[LATEST RELEASE]</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
@@ -74,6 +86,10 @@ GitHub Releases for Java , 基于 [GitHub REST API](https://docs.github.com/cn/r
|
|||||||
|
|
||||||
```groovy
|
```groovy
|
||||||
repositories {
|
repositories {
|
||||||
|
|
||||||
|
// 采用Maven中心库,安全稳定,但版本更新需要等待同步
|
||||||
|
mavenCentral()
|
||||||
|
|
||||||
// 采用github依赖库,安全稳定,但需要配置 (推荐)
|
// 采用github依赖库,安全稳定,但需要配置 (推荐)
|
||||||
maven { url 'https://maven.pkg.github.com/CarmJos/GithubReleases4J' }
|
maven { url 'https://maven.pkg.github.com/CarmJos/GithubReleases4J' }
|
||||||
|
|
||||||
@@ -90,7 +106,7 @@ dependencies {
|
|||||||
|
|
||||||
## 开发示例
|
## 开发示例
|
||||||
|
|
||||||
请 [**点击这里**](src/test/java/GithubDemo.java) 查看示例代码。
|
请 [**点击这里**](src/test/java/GithubDemoChinese.java) 查看示例代码,也可以 [点击这里](https://github.com/CarmJos/UltraDepository/blob/master/src/main/java/cc/carm/plugin/ultradepository/hooker/UpdateChecker.java) 查看实例项目。
|
||||||
|
|
||||||
## 支持与捐赠
|
## 支持与捐赠
|
||||||
|
|
||||||
@@ -115,4 +131,4 @@ dependencies {
|
|||||||
> MIT 协议是所有开源许可中最宽松的一个,除了必须包含许可声明外,再无任何限制。
|
> MIT 协议是所有开源许可中最宽松的一个,除了必须包含许可声明外,再无任何限制。
|
||||||
>
|
>
|
||||||
> *以上文字来自 [五种开源协议GPL,LGPL,BSD,MIT,Apache](https://www.oschina.net/question/54100_9455) 。*
|
> *以上文字来自 [五种开源协议GPL,LGPL,BSD,MIT,Apache](https://www.oschina.net/question/54100_9455) 。*
|
||||||
</details>
|
</details>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<artifactId>githubreleases4j</artifactId>
|
<artifactId>githubreleases4j</artifactId>
|
||||||
<version>1.3.0</version>
|
<version>1.3.2</version>
|
||||||
|
|
||||||
<name>GithubReleases4J</name>
|
<name>GithubReleases4J</name>
|
||||||
<description>Github Releases for Java</description>
|
<description>Github Releases for Java</description>
|
||||||
@@ -53,11 +53,6 @@
|
|||||||
<name>Github Pages</name>
|
<name>Github Pages</name>
|
||||||
<url>https://CarmJos.github.io/GithubReleases4J</url>
|
<url>https://CarmJos.github.io/GithubReleases4J</url>
|
||||||
</site>
|
</site>
|
||||||
<repository>
|
|
||||||
<id>github</id>
|
|
||||||
<name>GitHub Packages</name>
|
|
||||||
<url>https://maven.pkg.github.com/CarmJos/GithubReleases4J</url>
|
|
||||||
</repository>
|
|
||||||
</distributionManagement>
|
</distributionManagement>
|
||||||
|
|
||||||
<scm>
|
<scm>
|
||||||
@@ -101,13 +96,13 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.json</groupId>
|
<groupId>org.json</groupId>
|
||||||
<artifactId>json</artifactId>
|
<artifactId>json</artifactId>
|
||||||
<version>20211205</version>
|
<version>20250517</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jetbrains</groupId>
|
<groupId>org.jetbrains</groupId>
|
||||||
<artifactId>annotations</artifactId>
|
<artifactId>annotations</artifactId>
|
||||||
<version>22.0.0</version>
|
<version>26.1.0</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
@@ -125,7 +120,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<version>2.22.1</version>
|
<version>3.5.6</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<useSystemClassLoader>false</useSystemClassLoader>
|
<useSystemClassLoader>false</useSystemClassLoader>
|
||||||
</configuration>
|
</configuration>
|
||||||
@@ -133,7 +128,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-gpg-plugin</artifactId>
|
<artifactId>maven-gpg-plugin</artifactId>
|
||||||
<version>1.6</version>
|
<version>3.2.8</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>sign-artifacts</id>
|
<id>sign-artifacts</id>
|
||||||
@@ -153,7 +148,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
<version>3.2.0</version>
|
<version>3.12.0</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<classifier>javadoc</classifier>
|
<classifier>javadoc</classifier>
|
||||||
<links>
|
<links>
|
||||||
@@ -177,7 +172,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.8.1</version>
|
<version>3.15.0</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>${java.version}</source>
|
<source>${java.version}</source>
|
||||||
<target>${java.version}</target>
|
<target>${java.version}</target>
|
||||||
@@ -188,12 +183,12 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-jar-plugin</artifactId>
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
<version>3.2.0</version>
|
<version>3.5.0</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-source-plugin</artifactId>
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
<version>3.2.0</version>
|
<version>3.4.0</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<phase>package</phase>
|
<phase>package</phase>
|
||||||
@@ -206,7 +201,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
<version>3.2.3</version>
|
<version>3.6.2</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<phase>package</phase>
|
<phase>package</phase>
|
||||||
@@ -239,5 +234,35 @@
|
|||||||
</resources>
|
</resources>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
|
||||||
</project>
|
<profile>
|
||||||
|
<id>ossrh</id>
|
||||||
|
<distributionManagement>
|
||||||
|
<snapshotRepository>
|
||||||
|
<id>ossrh</id>
|
||||||
|
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
|
||||||
|
</snapshotRepository>
|
||||||
|
|
||||||
|
<repository>
|
||||||
|
<id>ossrh</id>
|
||||||
|
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
|
||||||
|
</repository>
|
||||||
|
</distributionManagement>
|
||||||
|
</profile>
|
||||||
|
|
||||||
|
<profile>
|
||||||
|
<id>github</id>
|
||||||
|
<distributionManagement>
|
||||||
|
<repository>
|
||||||
|
<id>github</id>
|
||||||
|
<name>GitHub Packages</name>
|
||||||
|
<url>https://maven.pkg.github.com/CarmJos/GithubReleases4J</url>
|
||||||
|
</repository>
|
||||||
|
</distributionManagement>
|
||||||
|
</profile>
|
||||||
|
|
||||||
|
</profiles>
|
||||||
|
|
||||||
|
|
||||||
|
</project>
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
|
"extends": [
|
||||||
|
"config:recommended"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -39,4 +39,31 @@ public class GithubDemo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void checkUpdate() {
|
||||||
|
|
||||||
|
String owner = "Owner";
|
||||||
|
String repository = "RepoName";
|
||||||
|
|
||||||
|
Integer behindVersions = GithubReleases4J.getVersionBehind(
|
||||||
|
owner, repository,
|
||||||
|
"Token",// OAuth token if it is a private repository.
|
||||||
|
"Current Version Tag"
|
||||||
|
);
|
||||||
|
|
||||||
|
if (behindVersions == null) {
|
||||||
|
System.out.println("Check failed! Please check updates manually.");
|
||||||
|
System.out.println("Download at " + GithubReleases4J.getReleasesURL(owner, repository));
|
||||||
|
} else if (behindVersions == 0) {
|
||||||
|
System.out.println("Check successfully, Now is up-to-date.");
|
||||||
|
} else if (behindVersions > 0) {
|
||||||
|
System.out.println("Outdated! Now behind " + behindVersions + " versions.");
|
||||||
|
System.out.println("Download latest version at " + GithubReleases4J.getLatestReleaseURL(owner, repository));
|
||||||
|
} else {
|
||||||
|
System.out.println("Check failed! Current version doesn't exists.");
|
||||||
|
System.out.println("Please use original version to avoid security issues.");
|
||||||
|
System.out.println("Download latest version at " + GithubReleases4J.getLatestReleaseURL(owner, repository));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,70 @@
|
|||||||
|
import cc.carm.lib.githubreleases4j.GithubAsset;
|
||||||
|
import cc.carm.lib.githubreleases4j.GithubRelease;
|
||||||
|
import cc.carm.lib.githubreleases4j.GithubReleases4J;
|
||||||
|
import cc.carm.lib.githubreleases4j.GithubUser;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class GithubDemoChinese {
|
||||||
|
|
||||||
|
public void demo() {
|
||||||
|
|
||||||
|
String owner = "库主(用户名或组织名)";
|
||||||
|
String repository = "库名";
|
||||||
|
|
||||||
|
List<GithubRelease> releases = GithubReleases4J.listReleases("Owner", "RepoName");
|
||||||
|
// 列出项目中所有发行版
|
||||||
|
|
||||||
|
GithubRelease latestRelease = GithubReleases4J.getLatestRelease(
|
||||||
|
owner, repository, "Token" // 如果是私有项目 则需要输入OAuth token
|
||||||
|
); // 得到该库的最新发行
|
||||||
|
|
||||||
|
if (latestRelease != null) {
|
||||||
|
|
||||||
|
List<GithubAsset> assets = latestRelease.getAssets();
|
||||||
|
// 得到该发行下的所有附件
|
||||||
|
|
||||||
|
for (GithubAsset asset : assets) {
|
||||||
|
try {
|
||||||
|
asset.download(); // 使用原附件名直接下载
|
||||||
|
} catch (IOException exception) {
|
||||||
|
exception.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
GithubUser uploader = asset.getUploader(); // 得到附件的上传者
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
GithubUser author = latestRelease.getAuthor(); // 得到该发行的发布者
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void checkUpdate() {
|
||||||
|
|
||||||
|
String owner = "库主(用户名或组织名)";
|
||||||
|
String repository = "库名";
|
||||||
|
String version = "当前版本的 TagName";
|
||||||
|
|
||||||
|
Integer behindVersions = GithubReleases4J.getVersionBehind(
|
||||||
|
owner, repository, "Token",// 如果是私有项目 则需要输入OAuth token
|
||||||
|
version
|
||||||
|
);
|
||||||
|
|
||||||
|
if (behindVersions == null) {
|
||||||
|
System.out.println("检查更新失败! 请您手动检查版本更新。");
|
||||||
|
System.out.println("下载地址 " + GithubReleases4J.getReleasesURL(owner, repository));
|
||||||
|
} else if (behindVersions == 0) {
|
||||||
|
System.out.println("检查完成,当前已是最新版本。");
|
||||||
|
} else if (behindVersions > 0) {
|
||||||
|
System.out.println("发现新版本! 目前已落后 " + behindVersions + " 个版本。");
|
||||||
|
System.out.println("最新版下载地址 " + GithubReleases4J.getLatestReleaseURL(owner, repository));
|
||||||
|
} else {
|
||||||
|
System.out.println("检查更新失败! 当前版本未知,请您使用原生版本以避免安全问题。");
|
||||||
|
System.out.println("最新版下载地址 " + GithubReleases4J.getLatestReleaseURL(owner, repository));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -18,7 +18,7 @@ public class GithubReleasesTest {
|
|||||||
@Test
|
@Test
|
||||||
public void onTest() {
|
public void onTest() {
|
||||||
|
|
||||||
GithubReleases4J.listReleases("CarmJos", "EasyPlugin")
|
GithubReleases4J.listReleases("CarmJos", "GithubReleases4J")
|
||||||
.stream().limit(2).forEach(GithubReleasesTest::printInfo);
|
.stream().limit(2).forEach(GithubReleasesTest::printInfo);
|
||||||
|
|
||||||
GithubRelease release = GithubReleases4J.getLatestRelease("CarmJos", "UltraDepository");
|
GithubRelease release = GithubReleases4J.getLatestRelease("CarmJos", "UltraDepository");
|
||||||
@@ -32,16 +32,18 @@ public class GithubReleasesTest {
|
|||||||
private static void printInfo(@Nullable GithubRelease release) {
|
private static void printInfo(@Nullable GithubRelease release) {
|
||||||
if (release == null) System.out.println("# NULL");
|
if (release == null) System.out.println("# NULL");
|
||||||
else {
|
else {
|
||||||
System.out.println("# " + release.getName() + " [" + FORMAT.format(release.getCreateTime()) + "]");
|
print("# %s %s [%s] ",
|
||||||
|
release.getRepository(), release.getName(),
|
||||||
|
FORMAT.format(release.getCreateTime())
|
||||||
|
);
|
||||||
List<GithubAsset> assets = release.getAssets();
|
List<GithubAsset> assets = release.getAssets();
|
||||||
assets.forEach(GithubReleasesTest::printAssets);
|
assets.forEach(GithubReleasesTest::printAssets);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void printAssets(@Nullable GithubAsset assets) {
|
private static void printAssets(@Nullable GithubAsset assets) {
|
||||||
if (assets == null) System.out.println("- NULL");
|
if (assets != null) {
|
||||||
else {
|
print("- %s (%s B)", assets.getName(), assets.getSize());
|
||||||
System.out.println("- " + assets.getName() + " [" + assets.getSize() + "]");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,12 +51,16 @@ public class GithubReleasesTest {
|
|||||||
if (!DOWNLOAD) return;
|
if (!DOWNLOAD) return;
|
||||||
if (assets == null) return;
|
if (assets == null) return;
|
||||||
try {
|
try {
|
||||||
File file = assets.download();
|
File file = assets.download(StandardCopyOption.REPLACE_EXISTING);
|
||||||
System.out.println("- at " + file.getAbsolutePath());
|
System.out.println("| -> " + file.getAbsolutePath());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void print(String format, Object... params) {
|
||||||
|
System.out.printf((format) + "%n", params);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import org.junit.Test;
|
|||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
|
||||||
public class GithubUserTestTest {
|
public class GithubUserInfoTest {
|
||||||
|
|
||||||
public static final SimpleDateFormat FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
public static final SimpleDateFormat FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import cc.carm.lib.githubreleases4j.GithubReleases4J;
|
import cc.carm.lib.githubreleases4j.GithubReleases4J;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class GithubVersionTest {
|
public class GithubVersionCheckerTest {
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
Reference in New Issue
Block a user