From 9290865519f59636e97ddbc0e07314ae6bf1f6d1 Mon Sep 17 00:00:00 2001 From: Justin Pridgen Date: Mon, 5 Aug 2024 03:03:17 -0400 Subject: [PATCH] bugfixes + new workflow --- .github/workflows/build.yml | 62 ++++++++++++++++++------------------- CMakeLists.txt | 2 +- changelog.md | 4 +++ mod.json | 2 +- src/FREditPopup.cpp | 2 +- src/FakeRate.cpp | 1 + 6 files changed, 39 insertions(+), 34 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9d0307f..9e36ddb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -54,45 +54,46 @@ jobs: name: Build Output path: ${{ steps.build.outputs.build-output }} - draft: - name: Draft Release + release: + name: Release Version runs-on: ubuntu-latest needs: ['package'] steps: - - name: Delete Existing Release - uses: actions/github-script@v7 - env: - COMMIT_MESSAGE: ${{ github.event.head_commit.message }} - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const owner = process.env.GITHUB_REPOSITORY.split("/")[0]; - const repo = process.env.GITHUB_REPOSITORY.split("/")[1]; - const response = await github.rest.repos.listReleases({ owner, repo }); - console.log("Checking for existing release..."); - for (const release of response.data) { - if (release.tag_name == process.env.COMMIT_MESSAGE) { - console.log("Existing release found, deleting..."); - await github.rest.repos.deleteRelease({ owner, repo, release_id: release.id }); - await github.rest.git.updateRef({ - owner, - repo, - ref: `tags/${release.tag_name}`, - sha: context.sha, - force: true - }); - } - } - console.log("Done."); + - name: Find Version + id: version + run: | + curl -s https://raw.githubusercontent.com/${{ github.repository }}/master/mod.json -o mod.json + echo version=$(jq -r .version mod.json) >> $GITHUB_OUTPUT + + - name: Check Existing Release + id: check + run: | + RELEASE=$(gh release view ${{ steps.version.outputs.version }} --repo ${{ github.repository }} --json tagName) + if [ -z "$RELEASE" ]; then + echo "No release found for ${{ steps.version.outputs.version }}, continuing with release" + echo release=1 >> $GITHUB_OUTPUT + else + echo "Release found for ${{ steps.version.outputs.version }}, skipping release" + echo release=0 >> $GITHUB_OUTPUT + fi + + - name: Find Changelog + if: steps.check.outputs.release == '1' + id: changelog + run: | + curl -s https://raw.githubusercontent.com/${{ github.repository }}/master/changelog.md -o changelog.md + echo changelog=$(awk "/## ${{ steps.version.outputs.version }}/{flag=1; next} /##/{flag=0} flag" changelog.md | sed -e :a -e '/^\n*$/{$d;N;ba}') >> $GITHUB_OUTPUT - name: Download Build Output + if: steps.check.outputs.release == '1' uses: actions/download-artifact@v4 with: name: Build Output path: build-output - - name: Create Draft Release + - name: Release Version + if: steps.check.outputs.release == '1' uses: softprops/action-gh-release@v2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -100,6 +101,5 @@ jobs: files: | build-output/*.geode build-output/*.pdb - tag_name: ${{ github.event.head_commit.message }} - name: ${{ github.event.head_commit.message }} - draft: true + tag_name: ${{ steps.version.outputs.version }} + body: ${{ steps.changelog.outputs.changelog }} diff --git a/CMakeLists.txt b/CMakeLists.txt index e8c1d02..c5c5d51 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64") set(CMAKE_CXX_VISIBILITY_PRESET hidden) -project(FakeRate VERSION 1.3.1) +project(FakeRate VERSION 1.3.2) add_library(${PROJECT_NAME} SHARED src/FakeRate.cpp diff --git a/changelog.md b/changelog.md index 1bfc903..e265e6e 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,8 @@ # Fake Rate Changelog +## v1.3.2 (2024-08-05) +- Fixed a bug with legacy More Difficulties difficulties not displaying correctly in the fake rate popup +- Fixed a bug with auto levels not displaying difficulty faces correctly in the fake rate popup + ## v1.3.1 (2024-07-30) - Added Grandpa Demon's Infinity sprite - Adjusted Demons In Between difficulties diff --git a/mod.json b/mod.json index 3c2b80d..241541a 100644 --- a/mod.json +++ b/mod.json @@ -5,7 +5,7 @@ "win": "2.206", "mac": "2.206" }, - "version": "v1.3.1", + "version": "v1.3.2", "id": "hiimjustin000.fake_rate", "name": "Fake Rate", "developer": "hiimjustin000", diff --git a/src/FREditPopup.cpp b/src/FREditPopup.cpp index d213a50..abc648c 100644 --- a/src/FREditPopup.cpp +++ b/src/FREditPopup.cpp @@ -208,7 +208,7 @@ void FREditPopup::updateLabels() { if (Loader::get()->isModLoaded("uproxide.more_difficulties")) { if (m_moreDifficultiesOverride == 4 || m_moreDifficultiesOverride == 7 || m_moreDifficultiesOverride == 9) { m_mdSprite->setDisplayFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName( - fmt::format("uproxide.more_difficulties/MD_Difficulty{:02d}.png{}", m_moreDifficultiesOverride, m_legacy ? "_Legacy" : "").c_str())); + fmt::format("uproxide.more_difficulties/MD_Difficulty{:02d}{}.png", m_moreDifficultiesOverride, m_legacy ? "_Legacy" : "").c_str())); m_mdSprite->setPosition(m_difficultySprite->getPosition() + (m_legacy ? CCPoint { 0.0f, 0.0f } : CCPoint { 0.25f, -0.1f })); m_mdSprite->setVisible(true); m_difficultySprite->setOpacity(0); diff --git a/src/FakeRate.cpp b/src/FakeRate.cpp index a0137e8..b1d900a 100644 --- a/src/FakeRate.cpp +++ b/src/FakeRate.cpp @@ -17,6 +17,7 @@ int FakeRate::getBaseCurrency(int stars) { int FakeRate::getDifficultyFromLevel(GJGameLevel* level) { if (level->m_demon > 0) return level->m_demonDifficulty > 0 ? level->m_demonDifficulty + 4 : 6; + else if (level->m_autoLevel) return -1; else if (level->m_ratings < 5) return 0; else return level->m_ratingsSum / level->m_ratings; }