Refactor build command in windows-build.yml: Update NSIS installation… #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: electron-windows-nsis-build | |
on: | |
push: | |
branches: | |
- "**" | |
jobs: | |
build: | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
node-version: [18.x] | |
steps: | |
- name: Check out Git repository | |
uses: actions/checkout@v4 | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Set up pnpm | |
uses: pnpm/action-setup@v4 | |
- name: Check NSIS version before installation | |
run: | | |
$nsisPath = "C:\Program Files (x86)\NSIS\makensis.exe" | |
if (Test-Path $nsisPath) { | |
Write-Output "NSIS is already installed. Version:" | |
& $nsisPath /VERSION | |
} else { | |
Write-Output "NSIS is not installed." | |
} | |
shell: pwsh | |
- name: Install NSIS | |
run: | | |
$url = "https://netcologne.dl.sourceforge.net/project/nsis/NSIS%203/3.04/nsis-3.04.zip" | |
$output = "$env:TEMP\nsis-3.04.zip" | |
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 | |
Invoke-WebRequest -Uri $url -OutFile $output | |
Expand-Archive -Path $output -DestinationPath "C:\Program Files (x86)\NSIS" -Force | |
$env:PATH += ";C:\Program Files (x86)\NSIS" | |
echo "C:\Program Files (x86)\NSIS" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
shell: pwsh | |
- name: Check NSIS version after installation | |
run: | | |
$nsisPath = "C:\Program Files (x86)\NSIS\makensis.exe" | |
if (Test-Path $nsisPath) { | |
Write-Output "NSIS installed successfully. Version:" | |
& $nsisPath /VERSION | |
} else { | |
Write-Output "Failed to install NSIS." | |
exit 1 | |
} | |
shell: pwsh | |
- name: Install Dependencies | |
run: pnpm install --prefer-offline --no-frozen-lockfile | |
working-directory: ./native | |
- name: Build Electron App | |
run: pnpm run build | |
working-directory: ./native | |
- name: Create NSIS Installer | |
run: pnpx electron-builder --win --publish always | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
working-directory: ./native | |
- name: Upload Release Assets | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: ./native/release/**/*.exe | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |