From 3d9afbcc600e8d3d777884bee69c76be9a3fc236 Mon Sep 17 00:00:00 2001 From: carm Date: Sat, 22 Jan 2022 02:32:04 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/FUNDING.yml | 2 + .github/ISSUE_TEMPLATE/bugs_report.md | 30 +++ .github/ISSUE_TEMPLATE/feature_issues.md | 20 ++ .github/workflows/codeql-analysis.yml | 70 +++++++ .github/workflows/deploy.yml | 90 +++++++++ .github/workflows/maven.yml | 38 ++++ .gitignore | 4 + LICENSE | 21 +++ README.md | 121 +++++++++++++ README_enUS.md | 22 +++ pom.xml | 221 +++++++++++++++++++++++ 11 files changed, 639 insertions(+) create mode 100644 .github/FUNDING.yml create mode 100644 .github/ISSUE_TEMPLATE/bugs_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_issues.md create mode 100644 .github/workflows/codeql-analysis.yml create mode 100644 .github/workflows/deploy.yml create mode 100644 .github/workflows/maven.yml create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md create mode 100644 README_enUS.md create mode 100644 pom.xml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..fc0c2fb --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,2 @@ +#github: [ CarmJos ] +custom: [ 'https://donate.carm.cc' ] \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/bugs_report.md b/.github/ISSUE_TEMPLATE/bugs_report.md new file mode 100644 index 0000000..6c6a5a3 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bugs_report.md @@ -0,0 +1,30 @@ +--- +name: 问题提交 +about: 描述问题并提交,帮助我们对其进行检查与修复。 +title: '' +labels: bug +assignees: '' + +--- + +### **问题简述** +用简短的话语描述一下大概问题。 + +### **问题来源** +描述一下通过哪些操作才发现的问题,如: +1. 打开 '...' +2. 点击了 '....' +3. 出现了报错 '....' + +### **预期结果**(可选) +如果问题不发生,应该是什么情况 + +### **问题截图/问题报错** +如果有报错或输出,请提供截图。 + +### *操作环境** +请在后台输入 `version` 并复制相关输出。 + + +### **其他补充** +如有其他补充,可以在这里描述。 diff --git a/.github/ISSUE_TEMPLATE/feature_issues.md b/.github/ISSUE_TEMPLATE/feature_issues.md new file mode 100644 index 0000000..9407bad --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_issues.md @@ -0,0 +1,20 @@ +--- +name: 功能需求 +about: 希望我们提供更多的功能。 +title: '' +labels: enhancement +assignees: '' + +--- + +### **功能简述** +简单的描述一下你想要的功能 + +### **需求来源** +简单的描述一下为什么需要这个功能。 + +### **功能参考**(可选) +如果有相关功能的参考,如文本、截图,请提供给我们。 + +### **附加内容** +如果有什么小细节需要重点注意,请在这里告诉我们。 diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000..46d6202 --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,70 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL Analysis" + +on: + push: + branches: [ master ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ master ] + schedule: + - cron: '45 12 * * 1' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'java' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + # Learn more about CodeQL language support at https://git.io/codeql-language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main + + # 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) + - name: Autobuild + uses: github/codeql-action/autobuild@v1 + + # ℹ️ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl + + # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language + + #- run: | + # make bootstrap + # make release + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..12c2754 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,90 @@ +# 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 + +name: Deploy & Upload + +on: + # 支持手动触发构建 + workflow_dispatch: + release: + # 创建release的时候触发 + types: [ published ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: "Set up JDK" + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'adopt' + cache: maven + server-id: github + server-username: MAVEN_USERNAME + server-password: MAVEN_TOKEN + + - name: "Maven Deploy" + run: mvn -B deploy --file pom.xml -DskipTests + env: + MAVEN_USERNAME: ${{ github.repository_owner }} + MAVEN_TOKEN: ${{secrets.GITHUB_TOKEN}} + + - name: "Release Asset Upload" + id: upload-release-asset + uses: shogo82148/actions-upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: asset/*.jar + asset_content_type: application/java-archive + + - name: "Javadoc Deploy Staging" + run: | + rm -rf docs + mkdir -vp docs + cp -vrf target/apidocs/* docs/ + cp -vrf .documentation/JAVADOC-README.md docs/README.md + + - name: "Generate the Javadoc sitemap" + id: sitemap + uses: cicirello/generate-sitemap@v1 + with: + base-url-path: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }} + path-to-root: docs + + - name: "Output Javadoc stats" + run: | + echo "sitemap-path = ${{ steps.sitemap.outputs.sitemap-path }}" + echo "url-count = ${{ steps.sitemap.outputs.url-count }}" + echo "excluded-count = ${{ steps.sitemap.outputs.excluded-count }}" + + - name: "Configure Git" + env: + DEPLOY_PRI: ${{secrets.DEPLOY_PRI}} + run: | + sudo timedatectl set-timezone "Asia/Shanghai" + mkdir -p ~/.ssh/ + echo "$DEPLOY_PRI" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + ssh-keyscan github.com >> ~/.ssh/known_hosts + git config --global user.name 'CarmJos' + git config --global user.email 'carm@carm.cc' + + - name: "Commit Javadocs" + run: | + cd docs + git init + git remote add origin git@github.com:${{ github.repository }}.git + git checkout -b gh-pages + git add -A + git commit -m "API Document generated." + + - name: "Push javadocs" + run: | + cd docs + git push origin HEAD:gh-pages --force \ No newline at end of file diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml new file mode 100644 index 0000000..6b0d1d2 --- /dev/null +++ b/.github/workflows/maven.yml @@ -0,0 +1,38 @@ +# 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 + +name: Project Build & Tests + +on: + # 支持手动触发构建 + workflow_dispatch: + push: + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: "Set up JDK" + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'adopt' + cache: maven + server-id: github + server-username: MAVEN_USERNAME + server-password: MAVEN_TOKEN + - name: "Package" + run: mvn -B package --file pom.xml -Dmaven.javadoc.skip=true + env: + MAVEN_USERNAME: ${{ github.repository_owner }} + MAVEN_TOKEN: ${{secrets.GITHUB_TOKEN}} + - name: "Target Stage" + run: mkdir staging && cp target/*.jar staging + - name: "Upload artifact" + uses: actions/upload-artifact@v2 + with: + name: Artifact + path: staging diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..18faac9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +/.idea/ +/target/ +/*/target/ +**.iml \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..4cd0986 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Carm + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..a43b787 --- /dev/null +++ b/README.md @@ -0,0 +1,121 @@ +```text + _____ _ _ _ _ _____ _ _ _ _ + / ____(_) | | | | | | __ \ | | | || | | | +| | __ _| |_| |__ _ _| |__ | |__) |___| | ___ __ _ ___ ___ ___| || |_ | | +| | |_ | | __| '_ \| | | | '_ \| _ // _ \ |/ _ \/ _` / __|/ _ \/ __|__ _| | | +| |__| | | |_| | | | |_| | |_) | | \ \ __/ | __/ (_| \__ \ __/\__ \ | || |__| | + \_____|_|\__|_| |_|\__,_|_.__/|_| \_\___|_|\___|\__,_|___/\___||___/ |_| \____/ + +``` + +README LANGUAGES [ [ENGLISH](README_enUS.md) | [中文](README.md) ] + +# GithubReleases4J + +[![version](https://img.shields.io/github/v/release/CarmJos/GithubPM)](https://github.com/CarmJos/GithubPM/releases) +[![License](https://img.shields.io/github/license/CarmJos/GithubPM)](https://opensource.org/licenses/GPL-3.0) +[![workflow](https://github.com/CarmJos/GithubPM/actions/workflows/maven.yml/badge.svg?branch=master)](https://github.com/CarmJos/GithubPM/actions/workflows/maven.yml) +![CodeSize](https://img.shields.io/github/languages/code-size/CarmJos/GithubPM) +![Support](https://img.shields.io/badge/Minecraft-Java%201.16--Latest-green) +![](https://visitor-badge.glitch.me/badge?page_id=GithubPM.readme) + +GitHub Releases for Java , 基于 [GitHub REST API](https://docs.github.com/cn/rest/reference/releases) 实现。 + +本项目对 GitHub Releases 相关的信息进行了封装,方便开发直接进行使用。 + +## 包含功能 + +- Release 的基本信息 + - Tag版本号、标题、内容介绍等 +- Release 的作者信息 + - ID 、头像、身份等 +- Release 的附件信息 + - 附件的名称、类型、大小、下载链接等 + - 支持直接对附件进行下载 + +## 依赖方式 + +
+展开查看 Maven 依赖方式 + +```xml + + + + + + GithubReleases4J + GitHub Packages + https://maven.pkg.github.com/CarmJos/GithubReleases4J + + + + carm-repo + Carm's Repo + https://repo.carm.cc/repository/maven-public/ + + + + + + cc.carm.lib + githubreleases4j + [LATEST RELEASE] + compile + + + + +``` + +
+ +
+展开查看 Gradle 依赖方式 + +```groovy +repositories { + // 采用github依赖库,安全稳定,但需要配置 (推荐) + maven { url 'https://maven.pkg.github.com/CarmJos/GithubReleases4J' } + + // 采用我的私人依赖库,简单方便,但可能因为变故而无法使用 + maven { url 'https://repo.carm.cc/repository/maven-public/' } +} + +dependencies { + api "cc.carm.lib:githubreleases4j:[LATEST RELEASE]" +} +``` + +
+ +## 开发示例 + + + +## 支持与捐赠 + +若您觉得本项目做的不错,您可以 [点击这里](https://donate.carm.cc) 捐赠支持我! + +## 开源协议 + +本项目源码采用 [GNU General Public License v3.0](https://opensource.org/licenses/GPL-3.0) 开源协议。 + +
+关于 GPL 协议 + +> GNU General Public Licence (GPL) 有可能是开源界最常用的许可模式。GPL 保证了所有开发者的权利,同时为使用者提供了足够的复制,分发,修改的权利: +> +> #### 可自由复制 +> 你可以将软件复制到你的电脑,你客户的电脑,或者任何地方。复制份数没有任何限制。 +> #### 可自由分发 +> 在你的网站提供下载,拷贝到U盘送人,或者将源代码打印出来从窗户扔出去(环保起见,请别这样做)。 +> #### 可以用来盈利 +> 你可以在分发软件的时候收费,但你必须在收费前向你的客户提供该软件的 GNU GPL 许可协议,以便让他们知道,他们可以从别的渠道免费得到这份软件,以及你收费的理由。 +> #### 可自由修改 +> 如果你想添加或删除某个功能,没问题,如果你想在别的项目中使用部分代码,也没问题,唯一的要求是,使用了这段代码的项目也必须使用 GPL 协议。 +> +> 需要注意的是,分发的时候,需要明确提供源代码和二进制文件,另外,用于某些程序的某些协议有一些问题和限制,你可以看一下 @PierreJoye 写的 Practical Guide to GPL Compliance 一文。使用 GPL 协议,你必须在源代码代码中包含相应信息,以及协议本身。 +> +> *以上文字来自 [五种开源协议GPL,LGPL,BSD,MIT,Apache](https://www.oschina.net/question/54100_9455) 。* +
diff --git a/README_enUS.md b/README_enUS.md new file mode 100644 index 0000000..2177eb7 --- /dev/null +++ b/README_enUS.md @@ -0,0 +1,22 @@ +```text + _____ _ _ _ _ _____ _ _ _ _ + / ____(_) | | | | | | __ \ | | | || | | | +| | __ _| |_| |__ _ _| |__ | |__) |___| | ___ __ _ ___ ___ ___| || |_ | | +| | |_ | | __| '_ \| | | | '_ \| _ // _ \ |/ _ \/ _` / __|/ _ \/ __|__ _| | | +| |__| | | |_| | | | |_| | |_) | | \ \ __/ | __/ (_| \__ \ __/\__ \ | || |__| | + \_____|_|\__|_| |_|\__,_|_.__/|_| \_\___|_|\___|\__,_|___/\___||___/ |_| \____/ + +``` + +README LANGUAGES [ [ENGLISH](README_enUS.md) | [中文](README) ] + +# GithubReleases4J + +[![version](https://img.shields.io/github/v/release/CarmJos/GithubReleases4J)](https://github.com/CarmJos/GithubReleases4J/releases) +[![License](https://img.shields.io/github/license/CarmJos/GithubReleases4J)](https://opensource.org/licenses/GPL-3.0) +[![workflow](https://github.com/CarmJos/GithubReleases4J/actions/workflows/maven.yml/badge.svg?branch=master)](https://github.com/CarmJos/GithubReleases4J/actions/workflows/maven.yml) +![CodeSize](https://img.shields.io/github/languages/code-size/CarmJos/GithubReleases4J) +![Support](https://img.shields.io/badge/Minecraft-Java%201.16--Latest-green) +![](https://visitor-badge.glitch.me/badge?page_id=GithubReleases4J.readme) + +GitHub Releases for Java , based on [GitHub REST API](https://docs.github.com/cn/rest/reference/releases) . diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..e92bdae --- /dev/null +++ b/pom.xml @@ -0,0 +1,221 @@ + + + 4.0.0 + + + 11 + ${java.version} + ${java.version} + UTF-8 + UTF-8 + + + cc.carm.lib + githubreleases4j + 1.0.0 + + GithubReleases4J + Github Releases for Java + https://github.com/CarmJos/GithubReleases4J + + + + CarmJos + Carm Jos + carm@carm.cc + https://www.carm.cc + + + + + + The MIT License + https://opensource.org/licenses/MIT + + + + + GitHub Issues + https://github.com/CarmJos/GithubReleases4J/issues + + + + GitHub Actions + https://github.com/CarmJos/GithubReleases4J/actions/workflows/maven.yml + + + + https://github.com/CarmJos/GithubReleases4J/releases + + gh-pages + Github Pages + https://CarmJos.github.io/GithubReleases4J + + + github + GitHub Packages + https://maven.pkg.github.com/CarmJos/GithubReleases4J + + + + + + + carm-repo + Carm's Repo + https://repo.carm.cc/repository/maven-public/ + + + + central + https://repo1.maven.org/maven2/ + + + + sonatype + https://oss.sonatype.org/content/groups/public + + + + github + GitHub Packages + https://maven.pkg.github.com/CarmJos/* + + true + + + + + + + + + com.konghq + unirest-java + 3.13.6 + compile + + + + org.jetbrains + annotations + 22.0.0 + provided + + + + junit + junit + 4.13.2 + test + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.1 + + false + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.2.0 + + javadoc + + https://javadoc.io/doc/org.jetbrains/annotations/ + + false + UTF-8 + UTF-8 + UTF-8 + zh_CN + + + + attach-javadocs + + jar + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + ${java.version} + ${java.version} + UTF-8 + -parameters + + + + org.apache.maven.plugins + maven-jar-plugin + 3.2.0 + + + org.apache.maven.plugins + maven-source-plugin + 3.2.0 + + + package + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-shade-plugin + 3.2.3 + + + package + + shade + + + false + + + + + + + *:* + + META-INF/MANIFEST.MF + META-INF/*.txt + + + + + + + + + + src/main/resources + true + + + + + + \ No newline at end of file