diff --git a/.github/workflows/common.yml b/.github/workflows/common.yml index 7460cf8..580a9fd 100644 --- a/.github/workflows/common.yml +++ b/.github/workflows/common.yml @@ -15,7 +15,7 @@ on: jobs: build-common: - name: Build Common + name: Build runs-on: ubuntu-latest environment: Build steps: @@ -44,26 +44,109 @@ jobs: with: name: CustomSkinLoader-${{ inputs.type }}-${{ github.run_number }} path: build/libs - - - uses: softprops/action-gh-release@v1 - name: Publish to Github release - if: ${{ inputs.is-snapshot == false }} + + Upload: + needs: build-common + continue-on-error: true + strategy: + matrix: + website: [CurseForge,Modrinth] + modtype: [Fabric,Forge-Active,Forge-Legacy] + include: + - + website: TencentCOS + modtype: All + - + website: GitHub + modtype: All + name: ULT ${{ 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: - repo_token: ${{ secrets.GITHUB_TOKEN }} + 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 "minecraft_vers=$(grep "minecraft_full_versions=" "$path"/build.properties | grep -v "#" | sed "s/minecraft_full_versions=//")" >> $GITHUB_OUTPUT + - + if: ${{ matrix.modtype != 'All' }} + name: Test Placeholder + run: | + echo path=${{ steps.cslenv.outputs.path }} + echo filename=${{ steps.cslenv.outputs.filename }} + echo modloader=${{ steps.cslenv.outputs.modloader }} + echo mc_vers=${{ steps.cslenv.outputs.minecraft_vers }} + - + if: ${{ matrix.website == 'GitHub' && inputs.is-snapshot == 'false' }} + uses: softprops/action-gh-release@v1 + name: Publish to Github Release + with: + token: ${{ secrets.GITHUB_TOKEN }} + name: CustomSkinLoader ${{ github.ref }} + tag_name: ${{ github.ref }} + generate_release_notes: true files: | build/libs/* - tag_name: ${{ github.ref }} - - name: Publish to CurseForge/Modrinth - if: ${{ inputs.publish-task }} + if: ${{ matrix.website == 'TencentCOS' && inputs.publish-task }} + name: Publish to Tencent COS env: COS_BUCKET: ${{ secrets.COS_BUCKET }} COS_SECRET_ID: ${{ secrets.COS_SECRET_ID }} COS_SECRET_KEY: ${{ secrets.COS_SECRET_KEY }} - CURSEFORGE_API_KEY: ${{ secrets.CURSEFORGE_API_KEY }} - MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} 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 + # ./gradlew publishGprPublicationToGitHubPackagesRepository + + - + if: ${{ matrix.website == 'CurseForge' && inputs.is-snapshot == 'false' }} + name: Publish to CurseForge + uses: itsmeow/curseforge-upload@v3 + with: + file_path: "build/libs/${{ steps.cslenv.outputs.filename }}" + game_endpoint: "minecraft" + game_versions: "${{ steps.cslenv.outputs.minecraft_vers }},${{ steps.cslenv.outputs.modloader }}" + #project_id: "0" + token: ${{ secrets.CURSEFORGE_API_KEY }} + - + if: ${{ matrix.website == 'Modrinth' && inputs.is-snapshot == 'false' }} + name: Publish to Modrinth + uses: RubixDev/modrinth-upload@v1.0.0 + with: + token: ${{ secrets.MODRINTH_TOKEN }} + file_path: build/libs/${{ steps.cslenv.outputs.filename }} + #name: My super cool mod ${{ github.event.release.tag_name }} + version: ${{ github.ref }} + #changelog: ${{ github.event.release.body }} + #relations: P7dR8mSH:required + game_versions: ${{ steps.cslenv.outputs.minecraft_vers }} + release_type: release + loaders: $(echo ${{ steps.cslenv.outputs.modloader }} | sed "y/F/f/") + featured: true + project_id: idMHQ4n2