2024-08-07 12:49:19 +08:00
|
|
|
name: Java CI-CD with Gradle
|
2024-02-04 17:54:17 +08:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
tags:
|
|
|
|
- '*'
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
2024-08-26 08:55:32 +08:00
|
|
|
# 配置权限
|
2024-02-04 17:54:17 +08:00
|
|
|
permissions: write-all
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2024-08-26 08:55:32 +08:00
|
|
|
- uses: actions/checkout@v3
|
2024-09-11 10:37:09 +08:00
|
|
|
- name: "Set up JDK 21"
|
2024-08-26 08:55:32 +08:00
|
|
|
uses: actions/setup-java@v3
|
|
|
|
with:
|
|
|
|
java-version: '21'
|
|
|
|
distribution: 'zulu'
|
|
|
|
cache: gradle
|
|
|
|
- name: "Build with Gradle"
|
|
|
|
run: ./gradlew buildPlugin
|
|
|
|
- name: "Copy jar to staging"
|
2024-09-11 10:37:09 +08:00
|
|
|
run: |
|
|
|
|
mkdir staging && cp build/libs/*.jar staging/
|
|
|
|
env:
|
|
|
|
JAR_FILE: "staging/$(ls staging | grep .jar)"
|
2024-08-26 08:55:32 +08:00
|
|
|
- name: "Build & test"
|
|
|
|
run: |
|
|
|
|
TAG=$(echo $GITHUB_REF | sed 's/refs\/tags\///')
|
|
|
|
echo "done!"
|
2024-09-11 10:37:09 +08:00
|
|
|
- name: "GitHub Release"
|
|
|
|
uses: "marvinpinto/action-automatic-releases@latest"
|
2024-08-26 08:55:32 +08:00
|
|
|
with:
|
|
|
|
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
|
|
|
automatic_release_tag: "${{ steps.build.outputs.TAG }}"
|
|
|
|
prerelease: false
|
|
|
|
files: |
|
|
|
|
staging/*.jar
|
2024-09-11 10:37:09 +08:00
|
|
|
- name: "Upload to Modrinth"
|
|
|
|
uses: RubixDev/modrinth-upload@v1
|
|
|
|
with:
|
|
|
|
token: ${{ secrets.MODRINTH_TOKEN }}
|
|
|
|
file_path: ${{ env.JAR_FILE }}
|
2024-09-11 10:40:54 +08:00
|
|
|
name: $${{ steps.build.outputs.TAG }}
|
|
|
|
version: ${{ steps.build.outputs.TAG }}
|
|
|
|
changelog: "See https://github.com/ColdeZhang/Dominion/releases/tag/${{ steps.build.outputs.TAG }}"
|
2024-09-11 10:37:09 +08:00
|
|
|
game_versions: 1.20.1,1.20.2,1.20.3,1.20.4,1.20.5,1.20.6,1.21,1.21.1
|
|
|
|
release_type: beta
|
|
|
|
loaders: Bukkit,Folia,Paper,Purpur,Spigot
|
|
|
|
featured: true
|
|
|
|
project_id: vVZc7jAV
|