diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml index ab8c93c..bf0c4f1 100644 --- a/.github/workflows/prerelease.yml +++ b/.github/workflows/prerelease.yml @@ -1,4 +1,4 @@ -name: Deploy Pre-Release to Polymart +name: Deploy Pre-Release to Polymart/Modrinth on: push: @@ -42,10 +42,12 @@ jobs: # The desired behavior if no files are found using the provided path. if-no-files-found: error retention-days: 2 - - name: Deploy to Polymart + - name: Deploy to Polymart/Modrinth env: POLYMART_TOKEN: ${{ secrets.POLYMART_TOKEN }} + MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} run: | export VERSION=`cat build.gradle.kts | grep "version " | awk -F'"' '{print $2}'` + curl --no-progress-meter -A "AJUPDATER/1.0" -H "Authorization: $MODRINTH_TOKEN" -F data="{\"project_id\": \"dzacATni\", \"version_number\": \"$VERSION\", \"name\": \"Pre-release v$VERSION\", \"changelog\": \"Note: This is a (most likely) un-tested build. It is not guarenteed to work.

Change since previous build:
${{ github.event.head_commit.message }}\", \"file_parts\": [\"file\"], \"version_type\": \"beta\", \"loaders\": [\"bungeecord\", \"velocity\"], \"featured\": false, \"game_versions\": $(curl https://ajg0702.us/pl/updater/mc-versions.php), \"dependencies\": [], \"primary_file\": \"file\"}" -F "file=@build/libs/ajLeaderboards-$VERSION.jar" "https://api.modrinth.com/v2/version" curl -F "file=@free/build/libs/ajQueue-$VERSION.jar" -F api_key=$POLYMART_TOKEN -F resource_id="2535" -F version="$VERSION" -F title="Pre-release v$VERSION" -F beta=1 -F message=$'Note: This is a (most likely) un-tested build. It is not guarenteed to work!\n\nChange since previous build:\n[url=${{ github.event.compare }}"]${{ github.event.head_commit.message }}[/url]' "https://api.polymart.org/v1/postUpdate" curl -F "file=@premium/build/libs/ajQueuePlus-$VERSION.jar" -F api_key=$POLYMART_TOKEN -F resource_id="2714" -F version="$VERSION" -F title="Pre-release v$VERSION" -F beta=1 -F message=$'Note: This is a (most likely) un-tested build. It is not guarenteed to work!\n\nChange since previous build:\n[url=${{ github.event.compare }}"]${{ github.event.head_commit.message }}[/url]' "https://api.polymart.org/v1/postUpdate" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8ec3367..e7d84ed 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Deploy Release to Polymart +name: Deploy Release to Polymart/Modrinth on: push: @@ -34,11 +34,16 @@ jobs: retention-days: 2 - name: Download changelogs run: | - curl "https://ajg0702.us/pl/updater/changelogs.php?project=${{ github.repository }}" > changelogs.bb - - name: Deploy to Polymart + curl "https://ajg0702.us/pl/updater/changelogs.php?project=${{ github.repository }}" > changelogs.bb + curl "https://ajg0702.us/pl/updater/changelogs.php?project=${{ github.repository }}&format=html" > changelogs.html + - name: Deploy to Polymart/Modrinth env: POLYMART_TOKEN: ${{ secrets.POLYMART_TOKEN }} + MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} + DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} run: | export VERSION=`cat build.gradle.kts | grep "version " | awk -F'"' '{print $2}'` + curl --no-progress-meter -A "AJUPDATER/1.0" -H "Authorization: $MODRINTH_TOKEN" -F data="{\"project_id\": \"dzacATni\", \"version_number\": \"$VERSION\", \"name\": \"v$VERSION\", \"changelog\": \"$(cat changelogs.html)\", \"file_parts\": [\"file\"], \"version_type\": \"release\", \"loaders\": [\"bungeecord\", \"velocity\"], \"featured\": true, \"game_versions\": $(curl https://ajg0702.us/pl/updater/mc-versions.php), \"dependencies\": [], \"primary_file\": \"file\"}" -F "file=@free/build/libs/ajQueue-$VERSION.jar" "https://api.modrinth.com/v2/version" curl -F "file=@free/build/libs/ajQueue-$VERSION.jar" -F api_key=$POLYMART_TOKEN -F resource_id="2535" -F version="$VERSION" -F title="v$VERSION" -F message="$(cat changelogs.bb)" "https://api.polymart.org/v1/postUpdate" curl -F "file=@premium/build/libs/ajQueuePlus-$VERSION.jar" -F api_key=$POLYMART_TOKEN -F resource_id="2714" -F version="$VERSION" -F title="v$VERSION" -F message="$(cat changelogs.bb)" "https://api.polymart.org/v1/postUpdate" + curl -v --no-progress-meter -H "Content-Type: application/json" --request POST -d "{\"content\": \"<@&861713403080999003>\", \"embeds\": [{\"title\": \"${{ github.event.repository.name }} v$VERSION\", \"description\": \"Changelogs\n\n$(curl "https://ajg0702.us/pl/updater/changelogs.php?project=${{ github.repository }}&format=markdown")\n\n[Modrinth (free)](https://modrinth.com/plugin/ajQueue/version/$VERSION)\n[Polymart (free)](https://polymart.org/resource/2535/updates)\n[Polymart (plus)](https://polymart.org/resource/2714/updates)\", \"color\": 14845503, \"thumbnail\": {\"url\": \"https://ajg0702.us/pl/icons/${{ github.event.repository.name }}.png\"}}]}" "$DISCORD_WEBHOOK"