electron-userland / electron-wix-msi

:dvd: Create traditional MSI installers for your Electron app
MIT License
318 stars 91 forks source link

How to set installer name #141

Open linonetwo opened 2 years ago

linonetwo commented 2 years ago

Using arch

    {
      name: '@electron-forge/maker-wix',
      config: (arch) => {
        return {
          language: 1033,
          manufacturer: 'tiddlywiki.org',
          programFilesFolderName: 'TiddlyWiki',
          shortcutFolderName: 'TiddlyWiki',
          description,
          exe: `Install-TidGi-${version}-Windows-${arch}`,
          name: 'TidGi',
          ui: {
            chooseDirectory: true,
          },
          appIconPath: 'build-resources/icon.ico',
          // WiX distributables do not handle prerelease information in the app version, removing it from the MSI (-prerelease3.4)
          // and https://github.com/felixrieseberg/electron-wix-msi/issues/110 ask use to use fixed number
          version: '1.0.0',
        };
      },
    },

The exe here seem to be for the app exe, not the installer. But then there will be no way to set msi name.

linonetwo commented 2 years ago

The answer is manually rename it:

  Windows:
    runs-on: windows-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v2
        with:
          submodules: 'true'

      - name: Set up CV dependency for pngquant-bin
        uses: ilammy/msvc-dev-cmd@v1

      - name: Set up Node.js
        uses: actions/setup-node@v2
        with:
          node-version: 16.x

      - name: Get npm cache directory
        id: npm-cache
        run: |
          echo "::set-output name=dir::$(npm config get cache)"
      - uses: actions/cache@v3
        id: cache
        with:
          path: ${{ steps.npm-cache.outputs.dir }}
          key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
          restore-keys: |
            ${{ runner.os }}-node-

      - name: Install dependencies
        run: npm ci

      - name: Add msi to path
        run: echo "${env:wix}bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append

      - name: Make Windows (ia32)
        run: npm run make:win-ia32
        env:
          CSC_LINK: ${{ secrets.WIN_CERT }}
          CSC_KEY_PASSWORD: ${{ secrets.WIN_CERT_PASS }}
          CI: true
          CI_PULL_REQUEST: ${{ github.event_name == 'pull_request' }}
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      - name: Rename (ia32)
        run: |
          Get-ChildItem out/make/wix/ia32
          Rename-Item -Path "out/make/wix/ia32/TidGi.msi" -NewName "Install-TidGi-Windows-ia32.msi"
      - name: Make Windows (x64)
        run: npm run make:win-x64
        env:
          CSC_LINK: ${{ secrets.WIN_CERT }}
          CSC_KEY_PASSWORD: ${{ secrets.WIN_CERT_PASS }}
          CI: true
          CI_PULL_REQUEST: ${{ github.event_name == 'pull_request' }}
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      - name: Rename (x64)
        run: |
          Get-ChildItem out/make/wix/x64
          Rename-Item -Path "out/make/wix/x64/TidGi.msi" -NewName "Install-TidGi-Windows-x64.msi"
      - name: Make Windows (arm64)
        run: npm run make:win-arm
        env:
          CSC_LINK: ${{ secrets.WIN_CERT }}
          CSC_KEY_PASSWORD: ${{ secrets.WIN_CERT_PASS }}
          CI: true
          CI_PULL_REQUEST: ${{ github.event_name == 'pull_request' }}
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      - name: Rename (arm64)
        run: |
          Get-ChildItem out/make/wix/arm64
          Rename-Item -Path "out/make/wix/arm64/TidGi.msi" -NewName "Install-TidGi-Windows-arm64.msi"

      - name: Create Release
        uses: softprops/action-gh-release@v1
        if: startsWith(github.ref, 'refs/tags/')
        with:
          draft: true
          files: |
            out/make/**/*.exe
            out/make/**/*.msi
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      - name: Get Renderer Bundle Stats
        uses: vio/bundle-stats-action@v1.3.0
        with:
          id: renderer
          webpack-stats-path: 'out/webpack-stats-renderer.json'
          repo-token: ${{ secrets.GITHUB_TOKEN }}
      - name: Get Main Bundle Stats
        uses: vio/bundle-stats-action@v1.3.0
        with:
          id: main
          webpack-stats-path: 'out/webpack-stats-main.json'
          repo-token: ${{ secrets.GITHUB_TOKEN }}
    {
      name: '@electron-forge/maker-wix',
      config: (arch) => {
        return {
          language: 1033,
          manufacturer: 'tiddlywiki.org',
          programFilesFolderName: 'TiddlyWiki',
          shortcutFolderName: 'TiddlyWiki',
          description,
          exe: 'TidGi',
          name: 'TidGi',
          ui: {
            chooseDirectory: true,
          },
          appIconPath: 'build-resources/icon.ico',
          // WiX distributables do not handle prerelease information in the app version, removing it from the MSI (-prerelease3.4)
          // and https://github.com/felixrieseberg/electron-wix-msi/issues/110 ask use to use fixed number
          version: '1.0.0',
        };
      },
    },