Skip to content

Commit

Permalink
Fix windows installer and remove cache folder from artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
mmosca committed Aug 24, 2024
1 parent 3a70c8f commit f47f0c5
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 13 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -228,4 +228,64 @@ jobs:
with:
name: ${{env.BUILD_NAMEx64}}_MSI
path: ./apps/*.msi

build-windows-ia32:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Install linux utils
run: choco install --force -y awk grep sed
- name: Setup environment
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
run: |
# This is the hash of the commit for the PR
# when the action is triggered by PR, empty otherwise
COMMIT_ID=${{ github.event.pull_request.head.sha }}
# This is the hash of the commit when triggered by push
# but the hash of refs/pull/<n>/merge, which is different
# from the hash of the latest commit in the PR, that's
# why we try github.event.pull_request.head.sha first
COMMIT_ID=${COMMIT_ID:-${{ github.sha }}}
BUILD_SUFFIX=ci-$(date '+%Y%m%d')-$(git rev-parse --short ${COMMIT_ID})
VERSION=$(grep version package.json | sed 's/.*"\([0-9][0-9]*.[0-9]*.[0-9]*\)".*/\1/g')
echo "ACTIONS_STEP_DEBUG=true" >> $GITHUB_ENV
echo "BUILD_SUFFIX=${BUILD_SUFFIX}" >> $GITHUB_ENV
echo "BUILD_NAME=inav-blackbox-explorer_win32_${VERSION}_${BUILD_SUFFIX}" >> $GITHUB_ENV
mkdir ./apps/
shell: bash
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- uses: engineerd/[email protected]
with:
name: "Wix Toolset 3.1.4"
url: "https://github.com/wixtoolset/wix3/releases/download/wix3141rtm/wix314-binaries.zip"
pathInArchive: "/"
- name: Install deps
uses: nick-fields/retry@v3
with:
max_attempts: 3
retry_on: error
command: npm install
timeout_minutes: 10
- name: Build windows
run: npm run gulp release -- --platform="win" --arch="ia32" --installer
- name: Upload Windows x64 zip
uses: actions/upload-artifact@v4
with:
name: ${{env.BUILD_NAME}}_ZIP
path: ./apps/*.zip
- name: Upload Windows x64 msi
uses: actions/upload-artifact@v4
with:
name: ${{env.BUILD_NAME}}_MSI
path: ./apps/*.msi
- name: Upload Windows ia32 installer
uses: actions/upload-artifact@v4
with:
name: ${{env.BUILD_NAME}}_INSTALLER
path: ./apps/*.exe


6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,8 @@ debug/
release/

# artefacts for Visual Studio Code
/.vscode/
/.vscode/

*~
*.swp

6 changes: 3 additions & 3 deletions assets/windows/installer.iss
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#define CompanyUrl "https://github.com/iNavFlight/inav-blackbox-log-viewer"
#define ExecutableFileName "inav-blackbox-explorer.exe"
#define GroupName "INAV"
#define InstallerFileName "INAV-BlackboxExplorer_" + archName + "-installer" + "_" + version
#define SourcePath "..\..\" + sourceFolder + "\inav-blackbox-explorer\" + archName
#define InstallerFileName "INAV-BlackboxExplorer_win-" + archName + "-installer" + "_" + version
#define SourcePath "..\..\" + sourceFolder + "\inav-blackbox-explorer\win\" + archName
#define TargetFolderName "INAV-BlackboxExplorer"
#define UpdatesUrl "https://github.com/iNavFlight/blackbox-log-viewer/releases"

Expand Down Expand Up @@ -166,4 +166,4 @@ begin
end;
end;
end;
end;
end;
21 changes: 12 additions & 9 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,14 +280,14 @@ gulp.task('apps', gulp.series(['clean-apps', 'dist'], async function (done) {
console.log('Release build.');

process.chdir("dist");
console.log("cwd: " + process.cwd());

for (let i = 0; i < platforms.length; ++i) {
var archs = getArchs(platforms[i]);
for (let j = 0; j < archs.length; ++j) {
console.log('Building: ' + platforms[i] + '/' + archs[j]);
await nwbuild({
srcDir: './**/*',
cacheDir: '../cache',
mode: "build",
outDir: path.join("..", appsDir, pkg.name, platforms[i], archs[j]),
platform: platforms[i],
Expand Down Expand Up @@ -319,6 +319,7 @@ gulp.task('debug', gulp.series(['dist', 'clean-debug'], async function (done) {
console.log('Building: ' + platforms[i] + '/' + archs[j]);
await nwbuild({
srcDir: './**/*',
cacheDir: '../cache',
mode: "build",
outDir: path.join("..", debugDir, pkg.name, platforms[i], archs[j]),
platform: platforms[i],
Expand All @@ -341,11 +342,13 @@ function build_win_zip(arch) {
var pkg = require('./package.json');

// Create ZIP
console.log(`Creating ${arch} ZIP file...`);
var src = path.join(appsDir, pkg.name, arch);
console.log(`Creating ${arch} windows ZIP file...`);
var src = path.join(appsDir, pkg.name, 'win', arch);
console.log("Src: " + src);
//var output = fs.createWriteStream(path.join(appsDir, get_release_filename(arch, 'zip', '-portable')));
var output = fs.createWriteStream(path.join(appsDir, get_release_filename(arch, 'zip')));
var outputPath = path.join(appsDir, get_release_filename('win', arch, 'zip'));
console.log('Dst: ' + outputPath);
var output = fs.createWriteStream(outputPath);
var archive = archiver('zip', {
zlib: { level: 9 }
});
Expand All @@ -365,10 +368,10 @@ function build_win_iss(arch) {
}

// Create Installer
console.log(`Creating ${arch} Installer...`);
console.log(`Creating ${arch} windows Installer...`);
const innoSetup = require('@quanle94/innosetup');

const APPS_DIR = './apps/';
const APPS_DIR = path.join(appsDir);
const pkg = require('./package.json');

// Parameters passed to the installer script
Expand All @@ -380,7 +383,7 @@ function build_win_iss(arch) {
parameters.push(`/DarchAllowed=x64`);
parameters.push(`/DarchInstallIn64bit=x64`);
parameters.push(`/DsourceFolder=${APPS_DIR}`);
parameters.push(`/DtargetFolder=${APPS_DIR}`);
parameters.push(`/DtargetFolder=${appsDir}`);

// Show only errors in console
parameters.push(`/Q`);
Expand All @@ -400,8 +403,8 @@ function build_win_iss(arch) {
}
}

gulp.task('release-win-x64', gulp.series(build_win_zip('win', 'x64'), build_win_iss('win', 'x64')));
gulp.task('release-win-ia32', gulp.series(build_win_zip('win', 'ia32'), build_win_iss('win', 'ia32')));
gulp.task('release-win-x64', gulp.series(build_win_zip('x64'), build_win_iss('x64')));
gulp.task('release-win-ia32', gulp.series(build_win_zip('ia32'), build_win_iss('ia32')));

gulp.task('release-osx-x64', function(done) {
var pkg = require('./package.json');
Expand Down

0 comments on commit f47f0c5

Please sign in to comment.