Skip to content

Commit

Permalink
Add release workflow and missing Ventura previews
Browse files Browse the repository at this point in the history
  • Loading branch information
t1m0thyj committed Aug 1, 2022
1 parent 1065025 commit b7a56a0
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 22 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
@@ -0,0 +1,43 @@
name: Release

on:
workflow_dispatch:
inputs:
version:
description: Version number for release
required: true
type: string

jobs:
release:
runs-on: windows-latest

steps:
- uses: actions/checkout@v2

- uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x

- uses: microsoft/setup-msbuild@v1

- run: scripts\version.ps1 ${{ github.event.inputs.version }}

# TODO Remove after https://github.com/Grabacr07/VirtualDesktop/pull/72 is published
- run: dotnet nuget add source --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/t1m0thyj/index.json"

- run: scripts\package.ps1

- uses: softprops/action-gh-release@v1
with:
draft: true
files: |
dist\*.exe
dist\checksums.txt
name: WinDynamicDesktop ${{ github.event.inputs.version }}
tag_name: v${{ github.event.inputs.version }}

- uses: actions/upload-artifact@v3
with:
name: msixupload
path: dist\*.msixupload
18 changes: 7 additions & 11 deletions scripts/i18n_download.py
@@ -1,23 +1,20 @@
#!/usr/bin/env python3
import os
import shutil
import sys

from dotenv import load_dotenv
from poeditor import POEditorAPI

os.chdir(os.path.dirname(os.path.realpath(__file__)))
load_dotenv()

mo_dir = "../i18n/mo"
po_dir = "../i18n/po"
file_type = sys.argv[1] if len(sys.argv) > 1 else "mo"
output_dir = sys.argv[2] if len(sys.argv) > 2 else "../src/locale"

if os.path.isdir(mo_dir):
shutil.rmtree(mo_dir)
os.mkdir(mo_dir)

if os.path.isdir(po_dir):
shutil.rmtree(po_dir)
os.mkdir(po_dir)
if len(sys.argv) > 2 and os.path.isdir(output_dir):
shutil.rmtree(output_dir)
os.makedirs(output_dir, exist_ok=True)

client = POEditorAPI(os.getenv("POEDITOR_TOKEN"))
projects = client.list_projects()
Expand All @@ -27,5 +24,4 @@

for lc in language_codes:
print(f"Downloading translation for {lc}")
client.export(project_id, lc, "po", local_file=f"{po_dir}/{lc}.po")
client.export(project_id, lc, "mo", local_file=f"{mo_dir}/{lc}.mo")
client.export(project_id, lc, file_type, local_file=f"{output_dir}/{lc}.{file_type}")
4 changes: 2 additions & 2 deletions scripts/i18n_gettext.py
Expand Up @@ -22,7 +22,7 @@ def add_to_pot_data(msgid, filename, lineno):


for filename in glob.glob("../src/**/*.cs", recursive=True):
with open(filename, 'r', encoding="utf8") as cs_file:
with open(filename, 'r', encoding="utf-8") as cs_file:
if not filename.endswith(".Designer.cs"):
msg_history = []

Expand Down Expand Up @@ -86,6 +86,6 @@ def add_to_pot_data(msgid, filename, lineno):

pot_lines.append("msgstr \"\"")

with open("../i18n/messages.pot", 'w', encoding="utf8") as pot_file:
with open("../i18n/messages.pot", 'w', encoding="utf-8") as pot_file:
for line in pot_lines:
print(line, file=pot_file)
19 changes: 10 additions & 9 deletions scripts/publish_choco.py
Expand Up @@ -13,16 +13,17 @@
nuspec_filename = "windynamicdesktop.nuspec"
script_filename = "tools/chocolateyInstall.ps1"

def installer_checksum(filename):
def installer_checksum(tag_name, filename):
checksums = {}
with open("../dist/checksums.txt", 'r') as fileobj:
for line in fileobj:
fst, snd = line.split()
checksums[snd] = fst
r = requests.get(f"https://github.com/t1m0thyj/WinDynamicDesktop/releases/download/{tag_name}/checksums.txt",
allow_redirects=True)
for line in r.text.splitlines():
fst, snd = line.split()
checksums[snd] = fst
return checksums[filename]

def render_template(filename, replacers):
with open(filename, 'r', encoding="utf8") as fileobj:
with open(filename, 'r', encoding="utf-8") as fileobj:
old_text = fileobj.read()
new_text = old_text
for key, value in replacers.items():
Expand All @@ -31,7 +32,7 @@ def render_template(filename, replacers):
return old_text

def write_file(filename, contents):
with open(filename, 'w', encoding="utf8") as fileobj:
with open(filename, 'w', encoding="utf-8") as fileobj:
fileobj.write(contents)

r = requests.get("https://api.github.com/repos/t1m0thyj/WinDynamicDesktop/releases/latest")
Expand All @@ -40,9 +41,9 @@ def write_file(filename, contents):
installer_url64 = next(a for a in response["assets"] if a["name"].endswith("x64_Setup.exe"))["browser_download_url"]
package_version = sys.argv[1] if len(sys.argv) > 1 else response["tag_name"][1:]
replacers = {
"installerChecksum": installer_checksum(os.path.basename(installer_url)),
"installerChecksum": installer_checksum(response["tag_name"], os.path.basename(installer_url)),
"installerUrl": installer_url,
"installerChecksum64": installer_checksum(os.path.basename(installer_url64)),
"installerChecksum64": installer_checksum(response["tag_name"], os.path.basename(installer_url64)),
"installerUrl64": installer_url64,
"packageVersion": package_version,
"releaseNotes": "\n".join(response["body"].splitlines()),
Expand Down
Binary file added src/resources/images/Ventura_Abstract_day.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/resources/images/Ventura_Abstract_night.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b7a56a0

Please sign in to comment.