diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 02161b2..041be9c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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 }} diff --git a/.gitignore b/.gitignore index 5e37898..82c3f1d 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,5 @@ node_modules /datatruck*.ts /datatruck*.json /datatruck*.yaml -config.schema.json \ No newline at end of file +config.schema.json +scripts/*.h \ No newline at end of file diff --git a/package.json b/package.json index 43539c3..91a3a66 100644 --- a/package.json +++ b/package.json @@ -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 .", diff --git a/scripts/build-win-setup.mjs b/scripts/build-win-setup.mjs new file mode 100644 index 0000000..412d5ea --- /dev/null +++ b/scripts/build-win-setup.mjs @@ -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); diff --git a/scripts/win-setup.iss b/scripts/win-setup.iss new file mode 100644 index 0000000..39dc4d1 --- /dev/null +++ b/scripts/win-setup.iss @@ -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"