From 4f6e64083a27301e6edfddd054631d985e45973b Mon Sep 17 00:00:00 2001 From: Alex Clarke Date: Thu, 19 Dec 2024 16:36:56 -0700 Subject: [PATCH] ci: Explicitly set the encoding as UTF-8 in the python script since that is not the windows default encoding [skip ci] --- .github/workflows/test-chocolatey-deploy.yml | 3 +-- deployment/chocolatey/packager.py | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-chocolatey-deploy.yml b/.github/workflows/test-chocolatey-deploy.yml index aeeb7aa..05b34a9 100644 --- a/.github/workflows/test-chocolatey-deploy.yml +++ b/.github/workflows/test-chocolatey-deploy.yml @@ -41,10 +41,9 @@ jobs: python "./deployment/chocolatey/packager.py" ${{ env.RELEASE_VERSION }} "./deployment/chocolatey/chocolateyinstall.ps1.template" "./deployment/chocolatey/tools/chocolateyinstall.ps1" ${{ env.WINDOWS_SHA }} # Publish to Chocolatey - cd ./deployment/chocolatey + cd ./deployment/chocolatey/ choco pack echo y | choco install managarr -dv -s . - refreshenv $version = managarr --version $version = $version -replace " ", "." choco push $version.nupkg -s https://push.chocolatey.org/ --api-key ${{ secrets.CHOCOLATEY_API_KEY }}; diff --git a/deployment/chocolatey/packager.py b/deployment/chocolatey/packager.py index e2d1837..d49ea79 100644 --- a/deployment/chocolatey/packager.py +++ b/deployment/chocolatey/packager.py @@ -16,12 +16,12 @@ print(" TEMPLATE PATH: %s" % template_file_path) print(" SAVING AT: %s" % generated_file_path) print(" HASH: %s" % hash_64) -with open(template_file_path, "r") as template_file: +with open(template_file_path, "r", encoding="utf-8") as template_file: template = Template(template_file.read()) substitute = template.safe_substitute(version=version, hash_64=hash_64) print("\n================== Generated package file ==================\n") print(substitute) print("\n============================================================\n") - with open(generated_file_path, "w") as generated_file: - generated_file.write(substitute) \ No newline at end of file + with open(generated_file_path, "w", encoding="utf-8") as generated_file: + generated_file.write(substitute)