Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
buxx committed Aug 5, 2024
1 parent 357e9cd commit 9fbf870
Show file tree
Hide file tree
Showing 6 changed files with 124 additions and 7 deletions.
33 changes: 26 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,16 @@ jobs:
with:
msystem: MINGW64
update: true
install: git mingw-w64-x86_64-cc mingw-w64-x86_64-rust mingw-w64-x86_64-sqlite3 mingw-w64-x86_64-pkg-config
install: git zip mingw-w64-x86_64-libzip mingw-w64-x86_64-rust mingw-w64-x86_64-sqlite3 mingw-w64-x86_64-pkg-config

- name: Run cargo check
run: cargo check --release

- name: Build
run: cargo build --release

- name: Package
run: tools/package_release_windows.sh ${{ github.ref_name }}

- name: Upload artifact
uses: actions/upload-release-asset@v1
Expand All @@ -58,9 +61,9 @@ jobs:
UPLOAD_URL: ${{ needs.create-release.outputs.upload_url }}
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: target/release/trsync.exe # FIXME : zip all executables ?
asset_name: trsync_${{ github.ref_name }}_Win64.zip
asset_content_type: application/octet-stream
asset_path: TrSync_${{ github.ref_name }}_Win64.zip
asset_name: TrSync_${{ github.ref_name }}_Win64.zip
asset_content_type: application/zip

build-linux:
name: Build and package for Linux
Expand All @@ -86,13 +89,29 @@ jobs:
- name: Build
run: cargo build --release

- name: Package
run: tools/package_release_linux.sh ${{ github.ref_name }}

- name: Upload artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
UPLOAD_URL: ${{ needs.create-release.outputs.upload_url }}
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: target/release/trsync # FIXME all in zip ?
asset_name: trsync_${{ github.ref_name }}_Linux
asset_content_type: application/octet-stream
asset_path: TrSync_${{ github.ref_name }}_Linux.zip
asset_name: TrSync_${{ github.ref_name }}_Linux.zip
asset_content_type: application/zip

build-windows-installer:
name: Build the Inno Setup Installer
needs: build-msys-mingw64
runs-on: windows-latest
steps:
- uses: actions/checkout@v4

- name: Compile .ISS to .EXE Installer
uses: Minionguyjpro/[email protected]
with:
path: src/setup.iss
options: /O+
Binary file added icon.ico
Binary file not shown.
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
74 changes: 74 additions & 0 deletions setup.iss
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "Trsync"
#define MyAppVersion "0.1"
#define MyAppPublisher "Bastien Sevajol"
#define MyAppURL "https://github.com/buxx/trsync"
#define MyAppExeName "trsync-manager-systray.exe"

[Setup]
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={F09009FF-131C-464F-B269-DB8FFF3DA90D} FFFFFFFFFFFFFFFFFFIXME !
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={autopf}\{#MyAppName}
DisableProgramGroupPage=yes
; Remove the following line to run in administrative install mode (install for all users.)
PrivilegesRequired=lowest
PrivilegesRequiredOverridesAllowed=commandline
OutputBaseFilename=trsync
Compression=lzma
SolidCompression=yes
WizardStyle=modern

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "french"; MessagesFile: "compiler:Languages\French.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: ".\trsync\target\release\trsync_manager_systray.exe"; DestDir: "{app}"; DestName: "trsync-manager-systray.exe"; Flags: ignoreversion
Source: ".\trsync.conf"; DestDir: "{localappdata}"; Flags: ignoreversion; AfterInstall: UpdateConfig()
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\trsync-manager-systray.exe"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\trsync-manager-systray.exe"; Tasks: desktopicon
Name: "{userstartup}\{#MyAppName}"; Filename: "{app}\trsync-manager-systray.exe"; WorkingDir: "{app}"

[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent;

[Code]
procedure UpdateConfig();
var
LocalAppDataValue : string;
FileName : string;
MyFile : TStrings;
MyText : string;
TrsyncManagerConfigurePath : string;
begin
LocalAppDataValue := ExpandConstant('{localappdata}');
FileName := LocalAppDataValue + '\trsync.conf';
MyFile := TStringList.Create;
try
MyFile.LoadFromFile(FileName);
MyText := MyFile.Text;
{ Only save if text has been changed. }
StringChangeEx(MyText, '\', '\\', True);
MyFile.Text := MyText;
MyFile.SaveToFile(FileName);
finally
MyFile.Free;
end;
end;
12 changes: 12 additions & 0 deletions tools/package_release_linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -e # stop at first error

[[ -z "$1" ]] && { echo "Please give package reference name as first parameter" ; exit 1; }
FOLDER_NAME=TrSync_${1}_Linux

mkdir -p ${FOLDER_NAME}
cp target/release/trsync ${FOLDER_NAME}
cp target/release/trsync_manager ${FOLDER_NAME}
cp target/release/trsync_manager_systray ${FOLDER_NAME}
cp LICENSE ${FOLDER_NAME}
zip -r ${FOLDER_NAME}.zip ${FOLDER_NAME}
12 changes: 12 additions & 0 deletions tools/package_release_windows.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -e # stop at first error

[[ -z "$1" ]] && { echo "Please give package reference name as first parameter" ; exit 1; }
FOLDER_NAME=TrSync_${1}_Win64

mkdir -p ${FOLDER_NAME}
cp target/release/trsync.exe ${FOLDER_NAME}
cp target/release/trsync_manager.exe ${FOLDER_NAME}
cp target/release/trsync_manager_systray.exe ${FOLDER_NAME}
cp LICENSE ${FOLDER_NAME}
zip -r ${FOLDER_NAME}.zip ${FOLDER_NAME}

0 comments on commit 9fbf870

Please sign in to comment.