From edeb80598dc2a317f3f8cc0f45bf913959df425c Mon Sep 17 00:00:00 2001 From: IQuant Date: Tue, 26 Nov 2024 19:25:55 +0300 Subject: [PATCH] Update CI and release job --- .github/workflows/release.yml | 8 +++++ scripts/check_pre_ci.py | 58 +++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 scripts/check_pre_ci.py diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2e3f1dc4..610b9063 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -95,13 +95,21 @@ jobs: needs: [build-mod, build-proxy-linux, build-proxy-windows] steps: + - uses: actions/checkout@v4 + with: + fetch-tags: true + # Not actually necessary to checkout anything, but have a single file just in case. + sparse-checkout: README.md - name: Download all workflow run artifacts uses: actions/download-artifact@v4 with: merge-multiple: true - name: List artifacts run: ls -R + - name: Get tag message + run: git tag -l --format='%(contents)' $(git describe --tags) > release_body.md - uses: ncipollo/release-action@v1 with: draft: true artifacts: "*.zip" + bodyFile: release_body.md diff --git a/scripts/check_pre_ci.py b/scripts/check_pre_ci.py new file mode 100644 index 00000000..8e832dbc --- /dev/null +++ b/scripts/check_pre_ci.py @@ -0,0 +1,58 @@ +from prepare_release import * + +def generate_notes(tag): + notes = ReleaseNotes() + + notes.title("Noita Entangled Worlds "+tag) + + notes.p("") + + notes.title("Accepted pull requests") + if pull_requests: + for request in pull_requests: + notes.l(request) + else: + notes.p("No pull requests have been accepted in this release.") + + notes.title("Installation") + notes.p("Download and unpack `noita-proxy-win.zip` or `noita-proxy-linux.zip`, depending on your OS. After that, launch the proxy.") + notes.p("Proxy is able to download and install the mod automatically. There is no need to download the mod (`quant.ew.zip`) manually.") + notes.p("""You'll be prompted for a path to `noita.exe` when launching the proxy for the first time. +It should be detected automatically as long as you use steam version of the game and steam is launched. + """) + + notes.title("Updating") + notes.p("There is a button in bottom-left corner on noita-proxy's main screen that allows to auto-update to a new version when one is available") + + print() + notes_path = "/tmp/rnotes.md" + with open(notes_path, "w") as f: + print(notes.gen_md(), file=f) + + subprocess.check_call(["nano", notes_path]) + + return notes_path + +def main(): + tag = "v"+version + if check_release_exists(tag): + print("Release already exists, exiting") + exit(1) + + subprocess.check_call(["git", "pull"]) + subprocess.check_call(["git", "commit", "-am", "Automated commit: "+tag]) + + + last_release = get_last_release() + print("Last release is:", last_release["name"]) + + pull_requests = get_pull_requests_from(last_release["publishedAt"]) + + notes_path = generate_notes(tag) + + subprocess.check_call(["git", "tag", "-a", "-F", notes_path ]) + subprocess.check_call(["git", "push"]) + + +if __name__ == "__main__": + main()