测试 hangar 发布脚本 #175
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Java CI-CD with Gradle | |
on: | |
push: | |
tags: | |
- '*' | |
jobs: | |
build: | |
permissions: write-all | |
runs-on: ubuntu-latest | |
outputs: | |
release_tag: ${{ steps.set_tag.outputs.tag }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: "Set up JDK 21" | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '21' | |
distribution: 'zulu' | |
cache: gradle | |
- name: "Build with Gradle" | |
run: ./gradlew buildPlugin | |
- name: "Prepare release artifacts" | |
run: | | |
mkdir -p staging | |
cp build/libs/*.jar staging/ | |
- name: "Set release tag" | |
id: set_tag | |
run: echo "tag=${GITHUB_REF_NAME}" >> $GITHUB_ENV | |
github-release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: "GitHub Release" | |
uses: marvinpinto/action-automatic-releases@latest | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: "${{ needs.build.outputs.release_tag }}" | |
prerelease: false | |
files: | | |
build/libs/*.jar | |
modrinth-release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: "Modrinth Release" | |
uses: dsx137/modrinth-release-action@main | |
env: | |
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} | |
TAG: ${{ needs.build.outputs.release_tag }} | |
with: | |
name: ${{ env.TAG }} | |
project_id: vVZc7jAV | |
loaders: bukkit,folia,paper,purpur,spigot | |
game_versions: 1.20.1:1.20.6,1.21,1.21.1 | |
version_number: ${{ env.TAG }} | |
files: | | |
build/libs/*.jar | |
changelog: "See https://github.com/ColdeZhang/Dominion/releases/tag/${{ env.TAG }}" | |
version_type: beta | |
featured: false | |
updatable: false | |
delete_old_files: false | |
hangar-release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: "Hangar Release" | |
env: | |
HANGAR_TOKEN: ${{ secrets.HANGAR_API_TOKEN }} | |
run: ./gradlew publishPluginPublicationToHangar --stacktrace |