Skip to content

Commit

Permalink
Add Windows EXE Release Support to FOSSLight Scanner GUI (#12)
Browse files Browse the repository at this point in the history
Signed-off-by: soonhong99 <[email protected]>
  • Loading branch information
soonhong99 authored Oct 6, 2024
1 parent 951b44f commit f00c72d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 10 deletions.
32 changes: 27 additions & 5 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,35 +17,57 @@ jobs:
- os: macos-latest
TARGET: macos
ASSET_MIME: application/zip
- os: windows-latest
TARGET: windows
ASSET_MIME: application/vnd.microsoft.portable-executable
steps:
- uses: actions/checkout@v3
- name: Get the version
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
shell: bash
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install dependencies
run: yarn install
- name: Clean previous build
run: npm run clean
- name: Build with yarn for ${{ matrix.TARGET }}
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
if [ "${{ matrix.TARGET }}" == "ubuntu" ]; then
yarn build
tar -czf fosslight-gui-${{ matrix.TARGET }}-setup-${{ env.VERSION }}.tar.gz -C dist/linux-unpacked .
sleep 5
tar -czf fosslight-gui-${{ matrix.TARGET }}-setup-${{ env.VERSION }}-temp.tar.gz -C dist/linux-unpacked .
mv fosslight-gui-${{ matrix.TARGET }}-setup-${{ env.VERSION }}-temp.tar.gz fosslight-gui-${{ matrix.TARGET }}-setup-${{ env.VERSION }}.tar.gz
elif [ "${{ matrix.TARGET }}" == "macos" ]; then
yarn build:mac
ditto -c -k --sequesterRsrc --keepParent "dist/mac/fosslight_gui.app" fosslight-gui-${{ matrix.TARGET }}-setup-${{ env.VERSION }}.zip
sleep 5
ditto -c -k --sequesterRsrc --keepParent "dist/mac/fosslight_gui.app" fosslight-gui-${{ matrix.TARGET }}-setup-${{ env.VERSION }}-temp.zip
mv fosslight-gui-${{ matrix.TARGET }}-setup-${{ env.VERSION }}-temp.zip fosslight-gui-${{ matrix.TARGET }}-setup-${{ env.VERSION }}.zip
echo "current location..."
pwd
elif [ "${{ matrix.TARGET }}" == "windows" ]; then
yarn build:win
sleep 5
7z a -tzip ./fosslight-gui-${{ matrix.TARGET }}-setup-${{ env.VERSION }}-temp.zip ./dist/win-unpacked/*
mv ./fosslight-gui-${{ matrix.TARGET }}-setup-${{ env.VERSION }}-temp.zip ./fosslight-gui-${{ matrix.TARGET }}-setup-${{ env.VERSION }}.zip
echo "Listing dist directory..."
ls ./dist
echo "current location..."
pwd
fi
shell: bash
- name: Upload Release Asset
id: upload-release-asset
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./fosslight-gui-${{ matrix.TARGET }}-setup-${{ env.VERSION }}.${{ matrix.TARGET == 'ubuntu' && 'tar.gz' || 'zip' }}
asset_name: fosslight-gui-${{ matrix.TARGET }}-setup-${{ env.VERSION }}.${{ matrix.TARGET == 'ubuntu' && 'tar.gz' || 'zip' }}
asset_path: ./fosslight-gui-${{ matrix.TARGET }}-setup-${{ env.VERSION }}.${{ matrix.TARGET == 'ubuntu' && 'tar.gz' || matrix.TARGET == 'macos' && 'zip' || 'zip' }}
asset_name: fosslight-gui-${{ matrix.TARGET }}-setup-${{ env.VERSION }}.${{ matrix.TARGET == 'ubuntu' && 'tar.gz' || matrix.TARGET == 'macos' && 'zip' || 'zip' }}
asset_content_type: ${{ matrix.ASSET_MIME }}
8 changes: 5 additions & 3 deletions electron-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ files:
- '!{.eslintignore,.eslintrc.cjs,.prettierignore,.prettierrc.yaml,dev-app-update.yml,CHANGELOG.md,README.md}'
- '!{.env,.env.*,.npmrc,pnpm-lock.yaml}'
- '!{tsconfig.json,tsconfig.node.json,tsconfig.web.json}'
- "out/**/*"
win:
artifactName: ${name}-${version}-${arch}-win.${ext}
executableName: fosslight_gui
target:
- target: nsis
Expand All @@ -21,7 +23,7 @@ win:
- x64
- arm64
nsis:
artifactName: ${name}-${version}-setup.${ext}
artifactName: ${name}-${version}-${arch}-win-setup.${ext}
shortcutName: ${productName}
uninstallDisplayName: ${productName}
createDesktopShortcut: always
Expand All @@ -30,6 +32,7 @@ nsis:
perMachine: false
allowToChangeInstallationDirectory: true
mac:
artifactName: ${name}-${version}-${arch}-mac.${ext}
target:
- target: zip
arch:
Expand All @@ -40,7 +43,6 @@ mac:
entitlementsInherit: build/entitlements.mac.plist
extendInfo:
- NSDocumentsFolderUsageDescription: Application requests access to the user's Documents folder.
- NSDownloadsFolderUsageDescription: Application requests access to the user's Downloads folder.
notarize: false
linux:
target:
Expand All @@ -58,7 +60,7 @@ linux:
maintainer: https://github.com/fosslight/fosslight_gui
synopsis: FOSSLight Scanner GUI Application
category: Utility
artifactName: ${name}-${version}-${arch}.${ext}
artifactName: ${name}-${version}-${arch}-linux.${ext}
snap:
base: core20
publish:
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@
"dev": "electron-vite dev --watch",
"build": "npm run typecheck && electron-vite build && electron-builder --dir",
"build:mac": "electron-vite build && electron-builder --mac --config electron-builder.yml",
"build:win": "npm run typecheck && electron-vite build && electron-builder build --win --config electron-builder.yml",
"postinstall": "electron-builder install-app-deps",
"release:win": "npm run typecheck && electron-vite build && electron-builder --win --config electron-builder.yml",
"release:mac": "npm run typecheck && electron-vite build && electron-builder --mac --config electron-builder.yml",
"release:linux-rpm-tar": "npm run typecheck && electron-vite build && electron-builder --linux rpm tar.gz --x64 --armv7l --arm64",
"release:linux-deb-snap": "npm run typecheck && electron-vite build && electron-builder --linux --config electron-builder.yml"
"release:linux-deb-snap": "npm run typecheck && electron-vite build && electron-builder --linux --config electron-builder.yml",
"clean": "rimraf dist"
},
"dependencies": {
"@electron-toolkit/preload": "^3.0.0",
Expand Down Expand Up @@ -51,6 +53,7 @@
"react-dom": "^18.2.0",
"tailwindcss": "^3.4.3",
"typescript": "^5.3.3",
"vite": "^5.0.12"
"vite": "^5.0.12",
"rimraf": "^3.0.2"
}
}

0 comments on commit f00c72d

Please sign in to comment.