mirror of
https://github.com/xfl03/MCCustomSkinLoader.git
synced 2026-11-11 07:57:28 +00:00
206 lines
7.4 KiB
YAML
206 lines
7.4 KiB
YAML
name: Common
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
type:
|
|
required: true
|
|
type: string
|
|
publish-task:
|
|
required: false
|
|
type: string
|
|
is-snapshot:
|
|
required: false
|
|
type: boolean
|
|
default: true
|
|
|
|
jobs:
|
|
build-common:
|
|
name: Build
|
|
runs-on: ubuntu-latest
|
|
environment: Build
|
|
steps:
|
|
-
|
|
name: Checkout
|
|
uses: actions/checkout@v3
|
|
-
|
|
name: Set up JDK
|
|
uses: actions/setup-java@v3
|
|
with:
|
|
distribution: 'temurin'
|
|
java-version: '8'
|
|
cache: 'gradle'
|
|
-
|
|
name: Build
|
|
env:
|
|
KEY_PASS: ${{ secrets.KEY_PASS }}
|
|
IS_SNAPSHOT: ${{ inputs.is-snapshot }}
|
|
run: |
|
|
echo Snapshot: $IS_SNAPSHOT
|
|
export GIT_COMMIT_DESC=$(git log --format=%B -n 1 $GITHUB_SHA)
|
|
./gradlew clean build --stacktrace
|
|
-
|
|
uses: actions/upload-artifact@v3
|
|
name: Publish to Github Artifact
|
|
with:
|
|
name: CustomSkinLoader-${{ inputs.type }}-${{ github.run_number }}
|
|
path: build/libs
|
|
|
|
Upload:
|
|
if: inputs.publish-task
|
|
needs: build-common
|
|
continue-on-error: true
|
|
environment: Build
|
|
strategy:
|
|
matrix:
|
|
website: [CurseForge_Modrinth]
|
|
modtype: [Fabric,Forge-Active,Forge-Legacy]
|
|
include:
|
|
-
|
|
website: TencentCOS
|
|
modtype: All
|
|
# -
|
|
# website: GitHub-Release
|
|
# modtype: All
|
|
-
|
|
website: GitHub-PreRelease
|
|
modtype: All
|
|
name: ${{ matrix.website }} (${{ matrix.modtype}})
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
-
|
|
name: Checkout Git Repository
|
|
uses: actions/checkout@v3
|
|
-
|
|
uses: actions/download-artifact@v3
|
|
name: Download Artifact Zips
|
|
with:
|
|
path: build
|
|
-
|
|
name: Preparation Folder
|
|
run: |
|
|
rsync -avz "build/$(ls build|grep "CustomSkinLoader")/" build/libs/
|
|
ls -lh build
|
|
-
|
|
if: ${{ matrix.modtype != 'All' }}
|
|
name: Checking and setting the environment
|
|
id: cslenv
|
|
run: |
|
|
output="$(ls build/libs | grep -v "sources")"
|
|
if [[ "${{ matrix.modtype }}" == "Forge"* ]]; then
|
|
modloader="Forge"
|
|
path=$(echo ${{ matrix.modtype }} | sed "s#-#/#")
|
|
else
|
|
modloader=${{ matrix.modtype }}
|
|
path=${{ matrix.modtype }}
|
|
fi
|
|
echo "path=$path" >> $GITHUB_OUTPUT
|
|
echo "modloader=$modloader" >> $GITHUB_OUTPUT
|
|
echo "filename=$(echo "$output"|grep $(echo ${{ matrix.modtype }}|sed "s#-##") )" >> $GITHUB_OUTPUT
|
|
echo "version=$(grep "version=" build.properties | grep -v "#" | sed "s/version=//")" >> $GITHUB_OUTPUT
|
|
echo "edition=$(echo ${{ matrix.modtype }} | sed "s/-//")" >> $GITHUB_OUTPUT
|
|
echo "minecraft_vers<<EOF" >> $GITHUB_OUTPUT
|
|
grep "minecraft_full_versions=" "$path"/build.properties | grep -v "#" | sed "s/minecraft_full_versions=//" | sed "s/,/\n/g" >> $GITHUB_OUTPUT
|
|
echo "EOF" >> $GITHUB_OUTPUT
|
|
echo "java_vers<<EOF" >> $GITHUB_OUTPUT
|
|
grep "java_full_versions=" "$path"/build.properties | grep -v "#" | sed "s/java_full_versions=//" | sed "s/,/\n/g" >> $GITHUB_OUTPUT
|
|
echo "EOF" >> $GITHUB_OUTPUT
|
|
-
|
|
if: startsWith(matrix.website, 'GitHub-')
|
|
name: Settings more strings to Environment
|
|
id: cslenv-github
|
|
run: |
|
|
#展开
|
|
echo "buildtime=$(TZ=Asia/Shanghai date "+%Y.%m.%d %H:%M")" >> $GITHUB_OUTPUT
|
|
echo "pathlist="$(find build/libs -type f|grep -v "sources"|grep -v "json")"" >> $GITHUB_OUTPUT
|
|
-
|
|
if: ${{ matrix.website == 'GitHub-PreRelease' && startsWith(github.ref, 'refs/heads') }}
|
|
name: 【GitHub Pre-Release】 Delete
|
|
uses: 8Mi-Tech/delete-release-assets-action@main
|
|
with:
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
tag: CI-Build
|
|
deleteOnlyFromDrafts: false
|
|
-
|
|
if: ${{ matrix.website == 'GitHub-PreRelease' && startsWith(github.ref, 'refs/heads') }}
|
|
name: 【GitHub Pre-Release】 Set CI-Build Text
|
|
run: |
|
|
cat > build/ci-build.md << 'EOF'
|
|
Build Time / 构建时间 : ${{ steps.cslenv-github.outputs.buildtime }}
|
|
自动同步分支 ${{ github.ref_name }} 的代码,以保持最新
|
|
Synchronize ${{ github.ref_name }} branch code updates, keeping only the latest version
|
|
<br>
|
|
[如何使用 / How to uses?](https://github.com/xfl03/MCCustomSkinLoader/wiki/How-to-Use)
|
|
EOF
|
|
-
|
|
if: ${{ matrix.website == 'GitHub-PreRelease' && startsWith(github.ref, 'refs/heads') }}
|
|
name: 【GitHub Pre-Release】 Upload Tag
|
|
uses: richardsimko/update-tag@v1
|
|
with:
|
|
tag_name: CI-Build
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
-
|
|
if: ${{ matrix.website == 'GitHub-PreRelease' && startsWith(github.ref, 'refs/heads') }}
|
|
name: 【GitHub Pre-Release】 Publish
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
name: CustomSkinLoader CI-Build
|
|
tag_name: CI-Build
|
|
prerelease: true
|
|
body_path: build/ci-build.md
|
|
files: build/libs/*
|
|
#iles: "${{ steps.cslenv-github.outputs.pathlist }}"
|
|
-
|
|
if: ${{ matrix.website == 'GitHub-Release' && inputs.type == 'Release' }}
|
|
uses: softprops/action-gh-release@v1
|
|
name: 【GitHub Release】 Publish
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
name: CustomSkinLoader ${{ github.ref }}
|
|
tag_name: ${{ github.ref }}
|
|
#generate_release_notes: true
|
|
files: ${{ steps.cslenv-github.outputs.pathlist }}
|
|
-
|
|
if: ${{ matrix.website == 'TencentCOS' }}
|
|
name: 【TencentCOS】 Publish
|
|
env:
|
|
COS_BUCKET: ${{ secrets.COS_BUCKET }}
|
|
COS_SECRET_ID: ${{ secrets.COS_SECRET_ID }}
|
|
COS_SECRET_KEY: ${{ secrets.COS_SECRET_KEY }}
|
|
IS_SNAPSHOT: ${{ inputs.is-snapshot }}
|
|
run: |
|
|
export GIT_COMMIT_DESC=$(git log --format=%B -n 1 $GITHUB_SHA)
|
|
./gradlew ${{ inputs.publish-task }} --info --stacktrace
|
|
# ./gradlew publishGprPublicationToGitHubPackagesRepository
|
|
|
|
-
|
|
if: ${{ matrix.website == 'CurseForge_Modrinth' && inputs.type == 'Release' }}
|
|
name: 【CurseForge & Modrinth】 Publish
|
|
uses: Kir-Antipov/mc-publish@v3.3
|
|
with:
|
|
modrinth-id: idMHQ4n2
|
|
modrinth-featured: true
|
|
modrinth-unfeature-mode: subset
|
|
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
|
|
|
|
curseforge-id: 286924
|
|
curseforge-token: ${{ secrets.CURSEFORGE_API_KEY }}
|
|
|
|
name: CustomSkinLoader_${{ steps.cslenv.outputs.edition }}_${{ steps.cslenv.outputs.version }}
|
|
version: ${{ steps.cslenv.outputs.version }}-${{ steps.cslenv.outputs.edition }}
|
|
version-type: release
|
|
loaders: ${{ steps.cslenv.outputs.modloader }}
|
|
game-versions: |
|
|
${{ steps.cslenv.outputs.minecraft_vers }}
|
|
game-version-filter: releases
|
|
java: |
|
|
${{ steps.cslenv.outputs.java_vers }}
|
|
|
|
retry-attempts: 2
|
|
retry-delay: 10000
|
|
fail-mode: fail
|
|
|
|
files: |
|
|
build/libs/${{ steps.cslenv.outputs.filename }}
|