add readme.md
All checks were successful
Gitea Actions Build / build and releases (push) Successful in 4m10s

This commit is contained in:
Armamem0t 2025-06-18 20:56:23 +08:00
parent 535d570b15
commit 27184c2fa0
Signed by: minglipro
GPG Key ID: 5F355A77B22AA93B
6 changed files with 261 additions and 3 deletions

View File

@ -32,7 +32,7 @@ jobs:
GROUPSID=$(echo "$GROUPSID" | tr -d '\r')
VERSIONS=$(echo "$VERSIONS" | tr -d '\r')
FILENAME="${GROUPSID}-${VERSIONS}.jar"
java -jar ${FILENAME} -s "${{gitea.server_url}}" -o "${{gitea.repository_owner}}" -r ${{gitea.event.repository.name}} -t "${{gitea.token}}" -ti "Auto releases ${{gitea.sha}} ${VERSIONS}" -b "# Auto releases wtih ${{gitea.event.head_commit.message}} - [${{gitea.sha}}](${{gitea.event.head_commit.url}})" -tn "Auto-Releases-${VERSIONS}" -a "build/libs"
java -jar build/libs/${FILENAME} -s "${{gitea.server_url}}" -o "${{gitea.repository_owner}}" -r ${{gitea.event.repository.name}} -t "${{gitea.token}}" -ti "Auto releases ${{gitea.sha}} ${VERSIONS}" -b "# Auto releases wtih ${{gitea.event.head_commit.message}} - [${{gitea.sha}}](${{gitea.event.head_commit.url}})" -tn "Auto-Releases-${VERSIONS}" -a "build/libs"

135
README.md
View File

@ -1,3 +1,136 @@
# com.mingliqiye.gitea.releases
- [a](666)
## language
[中文](README.md) | [English](README_EN.md)
## 说明
- 为了下载速度与处处碰壁的GITHUB
- 特地开发了一款可以上传gitea.releases的脚本
- 使用Java17 + gradle8.12 + okhttp3 + giteaWebApi
### Gitea文档
- [Create a repository](https://docs.gitea.com/zh-cn/api/#tag/repository/operation/createCurrentUserRepo)
- [Create a release attachment](https://docs.gitea.com/zh-cn/api/#tag/repository/operation/repoCreateReleaseAttachment)
## 使用
action.yaml
```yaml
- name: setup java
uses: https://git.mingliqiye.com/Actions/setup-java@v4
with:
distribution: 'oracle'
java-version: '17'
- name: releases
run: |
java -jar ${FILENAME} -s "${{gitea.server_url}}" -o "${{gitea.repository_owner}}" -r ${{gitea.event.repository.name}} -t "${{gitea.token}}" -ti "Auto releases ${{gitea.sha}} ${VERSIONS}" -b "# Auto releases wtih ${{gitea.event.head_commit.message}} - [${{gitea.sha}}](${{gitea.event.head_commit.url}})" -tn "Auto-Releases-${VERSIONS}" -a "build/libs"
```
## 命令行参数
| 序号 | 作用 | 短参数 | 长参数 | 类型 | 默认值 | 是否必须 | 示例 |
|----|-------------|-----|--------------------|---------|-------|------|-------------------------------|
| 1 | 显示帮助信息 | -h | --help | 没有值 | 无 | 否 | 无 |
| 2 | 显示版本信息 | -i | --info | 没有值 | 无 | 否 | 无 |
| 3 | 团队名 | -o | --repository-owner | string | 无 | 是 | Actions |
| 4 | 仓库名 | -r | --repository-name | string | 无 | 是 | com.mingliqiye.gitea.releases |
| 5 | releases的标题 | -ti | --title | string | 无 | 否 | Auto releases |
| 6 | releases的描述 | -b | --body | string | 无 | 否 | Auto releases${sha} |
| 7 | 服务器url | -s | --server-url | string | 无 | 是 | https://git.mingliqiye.com/ |
| 8 | 标签名 | -tn | --tag-name | string | 无 | 是 | Auto-releases |
| 9 | 提交版本 | -tc | --target-commitish | string | 无 | 否 | 无 |
| 10 | 是否为预发布 | -p | --pre-release | boolean | false | 否 | false |
| 11 | 是否为草稿 | -d | --draft | boolean | false | 否 | false |
# 编译
- 如果你想自行编译
## 1.克隆存储库
### 使用 http
```shell
git clone https://git.mingliqiye.com/Actions/com.mingliqiye.gitea.releases
```
### 使用 SHH
```shell
git clone git@git.mingliqiye.com:Actions/com.mingliqiye.gitea.releases.git
```
## 2.编译
### 使用本地 gradle
```shell
gradle
gradle build-jar
```
### 使用 gradle wrapper
- 如果你的地区下载 gradle wrapper 慢的话
[gradle-wrapper.properties](gradle/wrapper/gradle-wrapper.properties)
```properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
# 使用tencent云镜像
distributionUrl=https\://mirrors.cloud.tencent.com/gradle//gradle-8.12-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
```
- 然后
```shell
./gradlew
./gradlew build-jar
```
### 3.编译成功
```
> Task :help
Welcome to Gradle 8.12.
To run a build, run gradle <task> ...
...
For more on this, please refer to https://docs.gradle.org/8.12/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD SUCCESSFUL in 139ms
1 actionable task: 1 executed
```
```
> Task :compileJava
...
> Task :build-jar
>>> 构建成功!
>>> MD5: eafdeef5e2a6fabf6e0061795c57928d
>>> SHA1: 47e7905ef61de09a7836e43e77b0074b08e59756
>>> SHA256: 2e879a556a344673cc004cd819778d2a5dfea65d619646c4a94ae83c03f91c8a
>>> 输出文件: D:\data\java\com.mingliqiye.gitea.releases\build\libs\com.mingliqiye.gitea.releases-1.1.jar
>>> 输出文件: D:\data\java\com.mingliqiye.gitea.releases\build\libs\com.mingliqiye.gitea.releases-1.1.jar.MD5.txt
>>> 输出文件: D:\data\java\com.mingliqiye.gitea.releases\build\libs\com.mingliqiye.gitea.releases-1.1.jar.SHA1.txt
>>> 输出文件: D:\data\java\com.mingliqiye.gitea.releases\build\libs\com.mingliqiye.gitea.releases-1.1.jar.SHA256.txt
>>> 文件大小: 6.04875278472900390625 MB
[Incubating] Problems report is available at: file:///D:/data/java/com.mingliqiye.gitea.releases/build/reports/problems/problems-report.html
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.12/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD SUCCESSFUL in 3s
7 actionable tasks: 6 executed, 1 up-to-date
```
- 恭喜! 看到这样的输出就证明你编译成功了
- 还可以测试运行一下
```shell
java -jar ${FILENAME} -i
```

123
README_EN.md Normal file
View File

@ -0,0 +1,123 @@
# com.mingliqiye.gitea.releases
## Language
[中文](README.md) | [English](README_EN.md)
## Description
- Developed to address slow download speeds and accessibility issues with GitHub
- A script specifically designed to upload files to Gitea Releases
- Built with Java 17 + Gradle 8.12 + OkHttp3 + Gitea Web API
### Gitea Documentation
- [Create a repository](https://docs.gitea.com/api/#tag/repository/operation/createCurrentUserRepo)
- [Create a release attachment](https://docs.gitea.com//api/#tag/repository/operation/repoCreateReleaseAttachment)
## Usage
action.yaml
```yaml
- name: Setup Java
uses: https://git.mingliqiye.com/Actions/setup-java@v4
with:
distribution: 'oracle'
java-version: '17'
- name: Releases Upload
run: |
java -jar ${FILENAME} -s "${{gitea.server_url}}" -o "${{gitea.repository_owner}}" -r ${{gitea.event.repository.name}} -t "${{gitea.token}}" -ti "Auto releases ${{gitea.sha}} ${VERSIONS}" -b "# Auto releases wtih ${{gitea.event.head_commit.message}} - [${{gitea.sha}}](${{gitea.event.head_commit.url}})" -tn "Auto-Releases-${VERSIONS}" -a "build/libs"
```
## Command Line Parameters
| # | Purpose | Short | Long | Type | Default | Required | Example |
|---|---------------------|-------|-----------------------|---------|---------|----------|-------------------------------------|
| 1 | Show help | -h | --help | None | - | No | - |
| 2 | Show version info | -i | --info | None | - | No | - |
| 3 | Organization/Owner | -o | --repository-owner | string | - | Yes | Actions |
| 4 | Repository Name | -r | --repository-name | string | - | Yes | com.mingliqiye.gitea.releases |
| 5 | Release title | -ti | --title | string | - | No | Auto releases |
| 6 | Release description | -b | --body | string | - | No | Auto releases ${sha} |
| 7 | Server URL | -s | --server-url | string | - | Yes | https://git.mingliqiye.com/ |
| 8 | Tag name | -tn | --tag-name | string | - | Yes | Auto-releases |
| 9 | Target commitish | -tc | --target-commitish | string | - | No | - |
|10 | Mark as prerelease | -p | --pre-release | boolean | false | No | false |
|11 | Mark as draft | -d | --draft | boolean | false | No | false |
# Compilation
- To build from source:
## 1. Clone Repository
### Using HTTPS
```shell
git clone https://git.mingliqiye.com/Actions/com.mingliqiye.gitea.releases
```
### Using SSH
```shell
git clone git@git.mingliqiye.com:Actions/com.mingliqiye.gitea.releases.git
```
## 2. Build
### Using Local Gradle
```shell
gradle
gradle build-jar
```
### Using Gradle Wrapper
- Configure Tencent Cloud mirror in `gradle-wrapper.properties`:
```properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
# Tencent Cloud mirror
distributionUrl=https\://mirrors.cloud.tencent.com/gradle//gradle-8.12-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
```
- Then execute:
```shell
./gradlew
./gradlew build-jar
```
## 3. Successful Build Output
```
> Task :help
Welcome to Gradle 8.12.
... (build success messages) ...
BUILD SUCCESSFUL in 139ms
```
```
> Task :compileJava
... (build steps) ...
>>> Build successful!
>>> MD5: eafdeef5e2a6fabf6e0061795c57928d
>>> SHA1: 47e7905ef61de09a7836e43e77b0074b08e59756
>>> SHA256: 2e879a556a344673cc004cd819778d2a5dfea65d619646c4a94ae83c03f91c8a
>>> Output: D:\...\com.mingliqiye.gitea.releases-1.1.jar
>>> File size: 6.04875278472900390625 MB
BUILD SUCCESSFUL in 3s
```
- Congratulations! This output confirms a successful build.
- Test run:
```shell
java -jar ${FILENAME} -i
```

View File

@ -94,6 +94,7 @@ tasks.register("zipsrc", Zip) {
entryCompression = ZipEntryCompression.DEFLATED
from 'LICENSE' into '.'
from 'README.md' into '.'
from 'README_EN.md' into '.'
from fileTree(pathresources) into '.'
from fileTree(pathsource) into '.'
doLast {
@ -111,6 +112,7 @@ tasks.register("zipJar", Zip) {
from fileTree(assetspath) into '.'
from 'LICENSE' into '.'
from 'README.md' into '.'
from 'README_EN.md' into '.'
dependsOn tasks.addfile
dependsOn tasks.zipsrc
}

View File

@ -88,7 +88,7 @@ public class Main {
Options options = new Options();
Option help = new Option("h", "help", false, "显示帮助信息");
Option info = new Option("i", "info", false, "显示帮助信息");
Option info = new Option("i", "info", false, "显示版本信息");
Option token = new Option("t", "token", true, "token 不 包含 前缀的token");
Option repositoryOwner = new Option("o", "repository-owner", true, "团队名");
Option repositoryName = new Option("r", "repository-name", true, "仓库名");