Skip to content

Commit

Permalink
ci: add windows setup
Browse files Browse the repository at this point in the history
  • Loading branch information
juanrgm committed Oct 4, 2024
1 parent cd1f5cb commit cc32277
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 1 deletion.
28 changes: 28 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,31 @@ jobs:
tags: ${{ steps.image_meta.outputs.tags }}
labels: ${{ steps.image_meta.outputs.labels }}
push: ${{ steps.changesets_meta.outputs['@datatruck/cli:published'] }}
release-win-setup:
runs-on: windows-latest
needs: [release]
steps:
- uses: actions/download-artifact@v4
with:
name: release-artifacts
path: bin
- run: node scripts/build-win-setup.mjs
- name: Upload release assets
if: needs.release.steps.release-name.outputs['datatruck']
uses: softprops/action-gh-release@v1
with:
files: bin/*
name: datatruck@${{ needs.release.steps.release-name.outputs['datatruck'] }}
tag_name: datatruck@${{ needs.release.steps.release-name.outputs['datatruck'] }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create nightly release
if: needs.release.steps.release-name.outputs['datatruck'] == ''
uses: softprops/action-gh-release@v1
with:
tag_name: datatruck@nightly
name: datatruck@nightly
files: bin/*
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ node_modules
/datatruck*.ts
/datatruck*.json
/datatruck*.yaml
config.schema.json
config.schema.json
scripts/*.h
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"build:dist": "esbuild --bundle --platform=node --target=node20 ./packages/cli/lib/bin.js --outfile=dist/datatruck.js",
"build:schema": "node ./packages/cli/scripts/gen-schema.mjs",
"build:ts": "tsc -b tsconfig.build.json --pretty",
"build:win-setup": "node ./scripts/build-win-setup.mjs",
"clean": "tsc -b tsconfig.build.json --clean",
"format": "prettier --cache -w .",
"format:check": "prettier --cache -c .",
Expand Down
15 changes: 15 additions & 0 deletions scripts/build-win-setup.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { spawn } from "child_process";
import { readFile, writeFile } from "fs/promises";

const { version } = JSON.parse(
(await readFile("./packages/datatruck/package.json")).toString(),
);

writeFile("./scripts/win-setup-config.h", `#define VERSION "${version}"`);

const exec = spawn("iscc.exe", ["./scripts/win-setup.iss"], {
shell: true,
stdio: "inherit",
});

exec.on("close", process.exit);
23 changes: 23 additions & 0 deletions scripts/win-setup.iss
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include "./win-setup-config.h";

[Setup]
AppId=8af243ba-487b-436e-b766-aaf4805852f1
AppName=datatruck
AppVerName=datatruck
AppVersion={#VERSION}
AppPublisher=Juanra GM
AppPublisherURL=https://github.com/swordev/datatruck
DefaultDirName={commonpf}\swordev\datatruck
DefaultGroupName=datatruck
PrivilegesRequired=admin
OutputDir=./../bin/
OutputBaseFilename=datatruck-{#VERSION}-win-setup

[Files]
Source: "/../bin/datatruck-{#VERSION}-win.exe"; DestDir: "{app}\bin"; DestName: "datatruck.exe"; Flags: ignoreversion

[Run]
Filename: "{cmd}"; Parameters: "/C mklink ""{app}\bin\dtt.exe"" ""{app}\bin\datatruck.exe"""

[UninstallDelete]
Type: files; Name: "{app}\bin\dtt.exe"

0 comments on commit cc32277

Please sign in to comment.