diff --git a/.github/workflows/dbo_upload.yml b/.github/workflows/dbo_upload.yml index 3cf65bd6..03374575 100644 --- a/.github/workflows/dbo_upload.yml +++ b/.github/workflows/dbo_upload.yml @@ -1,4 +1,4 @@ -name: Manually upload release to dev.bukkit.org +name: Manually upload specific release to dev.bukkit.org on: workflow_dispatch: @@ -11,6 +11,14 @@ jobs: manually_upload_dbo_release: runs-on: ubuntu-latest steps: + - name: Get release info + id: release-info + uses: cardinalby/git-get-release-action@1.2.4 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag: ${{ steps.release.outputs.tag_name }} + - name: Download release artifact id: release-artifact uses: dsaltares/fetch-gh-release-asset@master @@ -19,40 +27,31 @@ jobs: version: tags/${{ github.event.inputs.version }} file: multiverse-core-${{ github.event.inputs.version }}.jar - - name: Build DBO metadata - id: metadata - uses: nickofthyme/object-remap@v1 - with: - changelog: ${{ toJson(steps.release-artifact.outputs.body) }} - changelog_type: markdown - release_type: release - display_name: ${{ github.event.inputs.version }} - game_versions: '[9994, 9974, 9973, 9561, 9560, 9261, 9190, 9016, 8897, 8849, 8503, 7915, 7667, 7330, 7105]' - relations.projects: '[{"slug": "multiverse-netherportals", "type": "optionalDependency"}, {"slug": "multiverse-portals", "type": "optionalDependency"}, {"slug": "multiverse-inventories", "type": "optionalDependency"}, {"slug": "multiverse-signportals", "type": "optionalDependency"}]' + - name: Parse release type + run: | + if [[ "${{ steps.release-info.outputs.prerelease }}" == "true" ]]; then + echo "Replacing prerelease version scheme with SNAPSHOT" + echo "RELEASE_TYPE=beta" >> $GITHUB_ENV + else + echo "Using release version scheme" + echo "RELEASE_TYPE=release" >> $GITHUB_ENV + fi - name: Upload to dev.bukkit.org - uses: Multiverse/http-request-action@debug + uses: benwoo1110/dbo-upload-action@v0.1.0 with: - url: https://dev.bukkit.org/api/projects/30765/upload-file - method: POST - contentType: multipart/form-data - customHeaders: '{ "X-Api-Token": "${{ secrets.DBO_UPLOAD_API_TOKEN }}" }' - files: '{ "file": "${{ github.workspace }}/multiverse-core-${{ github.event.inputs.version }}.jar" }' - data: '{ "metadata": ${{ toJson(steps.metadata.outputs.json) }} }' - -# Bukkit Version IDs -# 9994: 1.20.1 -# 9974: 1.20 -# 9973: 1.19.4 -# 9561: 1.19.3 -# 9560: 1.19.2 -# 9261: 1.19.1 -# 9190: 1.19 -# 9016: 1.18.2 -# 8897: 1.18.1 -# 8849: 1.18 -# 8503: 1.17 -# 7915: 1.16 -# 7667: 1.15 -# 7330: 1.14 -# 7105: 1.13 + api_token: ${{ secrets.DBO_UPLOAD_API_TOKEN }} + project_id: 30765 + changelog: ${{ steps.release-artifact.outputs.body }} + changelog_type: markdown + display_name: ${{ steps.release-artifact.outputs.version }} + game_versions: 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.18.1, 1.18.2, 1.19, 1.19.1, 1.19.2, 1.19.3, 1.19.4, 1.20, 1.20.1 + release_type: ${{ env.RELEASE_TYPE }} + project_relations: > + [ + {"slug": "multiverse-portals", "type": "optionalDependency"}, + {"slug": "multiverse-netherportals", "type": "optionalDependency"}, + {"slug": "multiverse-signportals", "type": "optionalDependency"}, + {"slug": "multiverse-inventories", "type": "optionalDependency"} + ] + file_path: ${{ github.workspace }}/subdir/multiverse-core-${{ steps.release-artifact.outputs.version }}.jar diff --git a/.github/workflows/modrinth_upload.yml b/.github/workflows/modrinth_upload.yml new file mode 100644 index 00000000..2ca430b8 --- /dev/null +++ b/.github/workflows/modrinth_upload.yml @@ -0,0 +1,41 @@ +name: Manually upload specific release to modrinth.com + +on: + workflow_dispatch: + inputs: + version: + description: 'Release to upload' + required: true + +jobs: + manually_upload_modrinth_release: + runs-on: ubuntu-latest + steps: + - name: Get release info + id: release-info + uses: cardinalby/git-get-release-action@1.2.4 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag: ${{ steps.release.outputs.tag_name }} + + - name: Parse release type + run: | + if [[ "${{ steps.release-info.outputs.prerelease }}" == "true" ]]; then + echo "Replacing prerelease version scheme with SNAPSHOT" + echo "RELEASE_TYPE=beta" >> $GITHUB_ENV + else + echo "Using release version scheme" + echo "RELEASE_TYPE=release" >> $GITHUB_ENV + fi + + - name: Upload to modrinth.com + uses: gradle/gradle-build-action@v2 + with: + arguments: build modrinth + env: + GITHUB_VERSION: ${{ env.VERSION }} + MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} + CHANGELOG: ${{ steps.release-info.outputs.body }} + VERSION_NUMBER: ${{ steps.release-info.outputs.tag_name }} + VERSION_TYPE: ${{ env.RELEASE_TYPE }} diff --git a/.github/workflows/promote_release.yml b/.github/workflows/promote_release.yml index d9ca65e4..63547184 100644 --- a/.github/workflows/promote_release.yml +++ b/.github/workflows/promote_release.yml @@ -89,20 +89,58 @@ jobs: asset_name: multiverse-core-${{ steps.release.outputs.tag_name }}.jar tag: ${{ steps.release.outputs.tag_name }} - - name: Get Changelog - id: changelog + - name: Get release info + id: release-info uses: cardinalby/git-get-release-action@1.2.4 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag: ${{ steps.release.outputs.tag_name }} - - name: Modrinth Upload + - name: Download release artifact + id: release-artifact + uses: dsaltares/fetch-gh-release-asset@master + with: + token: ${{ secrets.GITHUB_TOKEN }} + version: tags/${{ steps.release.outputs.tag_name }} + file: multiverse-core-${{ github.event.inputs.version }}.jar + + - name: Parse release type + run: | + if [[ "${{ steps.release-info.outputs.prerelease }}" == "true" ]]; then + echo "Replacing prerelease version scheme with SNAPSHOT" + echo "RELEASE_TYPE=beta" >> $GITHUB_ENV + else + echo "Using release version scheme" + echo "RELEASE_TYPE=release" >> $GITHUB_ENV + fi + + - name: Upload to modrinth.com uses: gradle/gradle-build-action@v2 with: arguments: build modrinth env: GITHUB_VERSION: ${{ env.VERSION }} MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} - CHANGELOG: ${{ steps.changelog.outputs.body }} - PRERELEASE: ${{ steps.changelog.outputs.prerelease }} + CHANGELOG: ${{ steps.release-artifact.outputs.body }} + VERSION_NUMBER: ${{ steps.release.outputs.tag_name }} + VERSION_TYPE: ${{ env.RELEASE_TYPE }} + + - name: Upload to dev.bukkit.org + uses: benwoo1110/dbo-upload-action@v0.1.0 + with: + api_token: ${{ secrets.DBO_UPLOAD_API_TOKEN }} + project_id: 30765 + changelog: ${{ steps.release-artifact.outputs.body }} + changelog_type: markdown + display_name: ${{ steps.release-artifact.outputs.version }} + game_versions: 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.18.1, 1.18.2, 1.19, 1.19.1, 1.19.2, 1.19.3, 1.19.4, 1.20, 1.20.1 + release_type: ${{ env.RELEASE_TYPE }} + project_relations: > + [ + {"slug": "multiverse-portals", "type": "optionalDependency"}, + {"slug": "multiverse-netherportals", "type": "optionalDependency"}, + {"slug": "multiverse-signportals", "type": "optionalDependency"}, + {"slug": "multiverse-inventories", "type": "optionalDependency"} + ] + file_path: ${{ github.workspace }}/subdir/multiverse-core-${{ steps.release-artifact.outputs.version }}.jar diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 772a8662..90e545b8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -63,20 +63,58 @@ jobs: asset_name: multiverse-core-${{ steps.release.outputs.tag_name }}.jar tag: ${{ steps.release.outputs.tag_name }} - - name: Get Changelog - id: changelog + - name: Get release info + id: release-info uses: cardinalby/git-get-release-action@1.2.4 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag: ${{ steps.release.outputs.tag_name }} - - name: Modrinth Upload + - name: Download release artifact + id: release-artifact + uses: dsaltares/fetch-gh-release-asset@master + with: + token: ${{ secrets.GITHUB_TOKEN }} + version: tags/${{ steps.release.outputs.tag_name }} + file: multiverse-core-${{ github.event.inputs.version }}.jar + + - name: Parse release type + run: | + if [[ "${{ steps.release-info.outputs.prerelease }}" == "true" ]]; then + echo "Replacing prerelease version scheme with SNAPSHOT" + echo "RELEASE_TYPE=beta" >> $GITHUB_ENV + else + echo "Using release version scheme" + echo "RELEASE_TYPE=release" >> $GITHUB_ENV + fi + + - name: Upload to modrinth.com uses: gradle/gradle-build-action@v2 with: arguments: build modrinth env: GITHUB_VERSION: ${{ env.VERSION }} MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} - CHANGELOG: ${{ steps.changelog.outputs.body }} - PRERELEASE: ${{ steps.changelog.outputs.prerelease }} + CHANGELOG: ${{ steps.release-artifact.outputs.body }} + VERSION_NUMBER: ${{ steps.release.outputs.tag_name }} + VERSION_TYPE: ${{ env.RELEASE_TYPE }} + + - name: Upload to dev.bukkit.org + uses: benwoo1110/dbo-upload-action@v0.1.0 + with: + api_token: ${{ secrets.DBO_UPLOAD_API_TOKEN }} + project_id: 30765 + changelog: ${{ steps.release-artifact.outputs.body }} + changelog_type: markdown + display_name: ${{ steps.release-artifact.outputs.version }} + game_versions: 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.18.1, 1.18.2, 1.19, 1.19.1, 1.19.2, 1.19.3, 1.19.4, 1.20, 1.20.1 + release_type: ${{ env.RELEASE_TYPE }} + project_relations: > + [ + {"slug": "multiverse-portals", "type": "optionalDependency"}, + {"slug": "multiverse-netherportals", "type": "optionalDependency"}, + {"slug": "multiverse-signportals", "type": "optionalDependency"}, + {"slug": "multiverse-inventories", "type": "optionalDependency"} + ] + file_path: ${{ github.workspace }}/subdir/multiverse-core-${{ steps.release-artifact.outputs.version }}.jar diff --git a/build.gradle b/build.gradle index 5eb98ac8..67a517d1 100644 --- a/build.gradle +++ b/build.gradle @@ -181,14 +181,8 @@ jar.enabled = false modrinth { token = System.getenv("MODRINTH_TOKEN") projectId = "multiverse-core" - versionNumber = version - - if(System.getenv("PRERELEASE")) { - versionType = "beta" - } else { - versionType = "release" - } - + versionNumber = System.getenv("VERSION_NUMBER") + versionType = System.getenv("VERSION_TYPE") uploadFile = jar gameVersions = ["1.20.1", "1.20", "1.19.4", "1.19.3", "1.19.2", "1.19.1", "1.19", "1.18.2", "1.18.1", "1.18", "1.17.1", "1.17", "1.16.5", "1.16.4", "1.16.3", "1.16.2", "1.16.1", "1.16", "1.15.2", "1.15.1", "1.15", "1.14.4", "1.14.3", "1.14.2", "1.14.1", "1.14", "1.13.2", "1.13.1", "1.13"] loaders = ["bukkit", "spigot", "paper"]