minglipro 27184c2fa0
All checks were successful
Gitea Actions Build / build and releases (push) Successful in 4m10s
add readme.md
2025-06-18 20:56:23 +08:00

123 lines
4.2 KiB
Markdown

# 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
```