From 4688813b2a33446b5b288c2fdb6fa1ed201ecf70 Mon Sep 17 00:00:00 2001
From: odrling <florianbadie@odrling.xyz>
Date: Thu, 19 Nov 2020 01:09:49 +0100
Subject: [PATCH] Add installer generation

---
 .github/workflows/msys.yml          | 21 ++++++++++++++++++++-
 packages/win_installer/aegisub3.iss | 26 ++++++++++++++------------
 2 files changed, 34 insertions(+), 13 deletions(-)

diff --git a/.github/workflows/msys.yml b/.github/workflows/msys.yml
index e8308bfb2..bedb62d6c 100644
--- a/.github/workflows/msys.yml
+++ b/.github/workflows/msys.yml
@@ -19,6 +19,10 @@ jobs:
             openssl
             ninja
             nasm
+            gettext
+            curl
+            unzip
+            tree
             mingw-w64-x86_64-boost
             mingw-w64-x86_64-wxWidgets
             mingw-w64-x86_64-cmake
@@ -27,9 +31,24 @@ jobs:
             mingw-w64-x86_64-ffms2
             mingw-w64-x86_64-glib2
             mingw-w64-x86_64-python-pip
-      - name: CI-Build
+
+      - name: Install Meson
         run: |
           MSYSTEM= pip install meson
+
+      - name: Build Aegisub
+        run: |
           MSYSTEM= meson builddir -Ddefault_library=static
           ninja -C builddir
 
+      - name: Create installer
+        run: |
+          tree
+          curl -o "aegisub-codecs.zip" https://mugen.karaokes.moe/downloads/aegisub-codecs.zip
+          for i in po/*.po; do
+            msgfmt -o $(basename $i .po).mo $i
+          done
+          cd packages/win_installer
+          curl -o "innosetup.zip" https://hikari.butaishoujo.moe/b/52a01bb4/innosetup.zip
+          unzip innosetup.zip
+          innosetup/ISCC.exe aegisub3.iss
diff --git a/packages/win_installer/aegisub3.iss b/packages/win_installer/aegisub3.iss
index 9fc12013b..9b5f27b83 100644
--- a/packages/win_installer/aegisub3.iss
+++ b/packages/win_installer/aegisub3.iss
@@ -76,18 +76,20 @@ begin
   CurStepChangedMigration(CurStep);
 
   if CurStep = ssPostInstall then
-  begin
-    if IsTaskSelected('checkforupdates') then
-      Updates := 'true'
-    else
-      Updates := 'false';
+    begin
+      if IsTaskSelected('checkforupdates') then
+        Updates := 'true';
+      else
+        Updates := 'false';
+      endif;
 
-    SaveStringToFile(
-      ExpandConstant('{app}\installer_config.json'),
-      FmtMessage('{"App": {"Auto": {"Check For Updates": %1}, "First Start": false, "Language": "%2"}}', [
-        Updates,
-        ExpandConstant('{language}')]),
-      False);
-  end;
+      SaveStringToFile(
+        ExpandConstant('{app}\installer_config.json'),
+        FmtMessage('{"App": {"Auto": {"Check For Updates": %1}, "First Start": false, "Language": "%2"}}', [
+          Updates,
+          ExpandConstant('{language}')]),
+        False);
+    end;
+  endif;
 end;
 
-- 
GitLab