Skip to content

Commit

Permalink
chore: split packaging for windows builds [INS-3983] (#7838)
Browse files Browse the repository at this point in the history
* chore: split package for windows codesign [INS-3983]

* fix

* fix

* fix

* prepare for proper release-build pipeline

* tidy up
  • Loading branch information
filfreire authored Aug 23, 2024
1 parent be8a04c commit 1067afa
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 16 deletions.
48 changes: 43 additions & 5 deletions .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ jobs:
- name: Install packages
run: npm ci

- name: Setup Inso CLI version env var
run: |
echo "INSO_VERSION=$(jq .version ./packages/${{ env.INSO_PACKAGE_NAME }}/package.json -rj)" >> $GITHUB_ENV
# If this step fails its possible apple has new license terms which need to be accepted by logging into https://developer.apple.com/account
- name: Package app (MacOS only)
if: matrix.os == 'macos-13'
Expand All @@ -78,16 +82,50 @@ jobs:
CSC_LINK: ${{ matrix.csc_link_secret != '' && secrets[matrix.csc_link_secret] || '' }}
CSC_KEY_PASSWORD: ${{ matrix.csc_key_password_secret != '' && secrets[matrix.csc_key_password_secret] || '' }}

- name: Package app (Windows and Linux)
if: matrix.os != 'macos-13'
- name: Package app (Linux only)
if: matrix.os == 'ubuntu-latest'
shell: bash
run: npm run app-package
env:
NODE_OPTIONS: '--max_old_space_size=6144'

- name: Setup Inso CLI version env var
run:
echo "INSO_VERSION=$(jq .version ./packages/${{ env.INSO_PACKAGE_NAME }}/package.json -rj)" >> $GITHUB_ENV
# creates unpacked electron-builder contents that can be signed afterwards
- name: Package unpacked app (Windows only)
if: matrix.os == 'windows-latest'
shell: bash
run: NODE_OPTIONS='--max_old_space_size=6144' npm run package:windows:unpacked -w insomnia

# signs unpacked electron-builder contents, in this case only the .exe
- name: Code-sign unpacked .exe (Windows only)
if: matrix.os == 'windows-latest'
uses: sslcom/esigner-codesign@develop
with:
command: sign
username: ${{secrets.ES_USERNAME}}
password: ${{secrets.ES_PASSWORD}}
credential_id: ${{secrets.ES_CREDENTIAL_ID}}
totp_secret: ${{secrets.ES_TOTP_SECRET}}
file_path: packages/insomnia/dist/win-unpacked/Insomnia.exe
override: true

# re-packages the now code-signed electron-builder contents into a squirrel installer
- name: Package dist app (Windows only)
if: matrix.os == 'windows-latest'
shell: bash
run: NODE_OPTIONS='--max_old_space_size=6144' npm run package:windows:dist -w insomnia

# code-signs the windows installer
- name: Code-sign Windows Installer artifact (Windows only)
if: matrix.os == 'windows-latest'
uses: sslcom/esigner-codesign@develop
with:
command: sign
username: ${{secrets.ES_USERNAME}}
password: ${{secrets.ES_PASSWORD}}
credential_id: ${{secrets.ES_CREDENTIAL_ID}}
totp_secret: ${{secrets.ES_TOTP_SECRET}}
file_path: packages/insomnia/dist/squirrel-windows/Insomnia.Core-${{ env.INSO_VERSION }}.exe
override: true

- name: Package inso
run: |
Expand Down
11 changes: 0 additions & 11 deletions .github/workflows/release-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,6 @@ jobs:
with:
path: ${{ env.ELECTRON_ARTIFACT_BASE64_FILE }}

- name: Code-sign Windows .exe artifact
uses: sslcom/esigner-codesign@develop
with:
command: sign
username: ${{secrets.ES_USERNAME}}
password: ${{secrets.ES_PASSWORD}}
credential_id: ${{secrets.ES_CREDENTIAL_ID}}
totp_secret: ${{secrets.ES_TOTP_SECRET}}
file_path: ${GITHUB_WORKSPACE}/artifacts/windows-latest-artifacts/insomnia/dist/squirrel-windows/Insomnia.Core-${{ env.RELEASE_VERSION }}.exe
override: true

- name: Create Tag and Release
uses: ncipollo/release-action@v1
id: core_tag_and_release
Expand Down
2 changes: 2 additions & 0 deletions packages/insomnia/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
"build:main.min.js": "cross-env NODE_ENV=development esr esbuild.main.ts",
"lint": "eslint . --ext .js,.ts,.tsx --cache",
"package": "npm run build:app && cross-env USE_HARD_LINKS=false electron-builder build --config electron-builder.config.js",
"package:windows:unpacked": "npm run build:app && cross-env USE_HARD_LINKS=false electron-builder build --config electron-builder.config.js --dir",
"package:windows:dist": "cross-env USE_HARD_LINKS=false electron-builder build --config electron-builder.config.js --prepackaged ./dist/win-unpacked",
"start": "concurrently -n browser,main --kill-others \"npm run start:dev-server\" \"npm run start:electron\"",
"start:dev-server": "vite dev",
"start:electron": "cross-env NODE_ENV=development esr esbuild.main.ts && electron --inspect=5858 .",
Expand Down

0 comments on commit 1067afa

Please sign in to comment.