mirror of
https://github.com/fergalmoran/picard.git
synced 2026-02-24 00:26:08 +00:00
Github Actions: Package Windows app
This commit is contained in:
43
.github/workflows/package-windows.yml
vendored
Normal file
43
.github/workflows/package-windows.yml
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
name: Package for Windows
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
package:
|
||||
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Set up Python 3.7
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: 3.7
|
||||
- name: Setup Windows build environment
|
||||
run: |
|
||||
& .\scripts\package\win-setup.ps1 -DiscidVersion $Env:DISCID_VERSION -FpcalVersion $Env:FPCALC_VERSION
|
||||
env:
|
||||
DISCID_VERSION: 0.6.2
|
||||
FPCALC_VERSION: 1.4.3
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements-build.txt
|
||||
pip install -r requirements-win.txt
|
||||
- name: Build Windows 10 app package
|
||||
run: |
|
||||
$Env:PATH += ";C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x64"
|
||||
$Certificate = @(Get-ChildItem cert:\CurrentUser\My -codesign)[0]
|
||||
& .\scripts\package\win-package-appx.ps1 -BuildNumber $(git rev-list --count HEAD) -Certificate $Certificate
|
||||
- name: Build Windows installer
|
||||
if: always()
|
||||
run: |
|
||||
choco install nsis
|
||||
$Certificate = @(Get-ChildItem cert:\CurrentUser\My -codesign)[0]
|
||||
& .\scripts\package\win-package-installer.ps1 -BuildNumber $(git rev-list --count HEAD) -Certificate $Certificate
|
||||
dist\picard\fpcalc -version
|
||||
- name: Build Windows portable app
|
||||
if: always()
|
||||
run: |
|
||||
$Certificate = @(Get-ChildItem cert:\CurrentUser\My -codesign)[0]
|
||||
& .\scripts\package\win-package-portable.ps1 -BuildNumber $(git rev-list --count HEAD) -Certificate $Certificate
|
||||
@@ -7,6 +7,10 @@ Param(
|
||||
$BuildNumber
|
||||
)
|
||||
|
||||
# Errors are handled explicitly. Otherwise any output to stderr when
|
||||
# calling classic Windows exes causes a script error.
|
||||
$ErrorActionPreference = 'Continue'
|
||||
|
||||
If (-Not $BuildNumber) {
|
||||
$BuildNumber = 0
|
||||
}
|
||||
|
||||
@@ -7,6 +7,10 @@ Param(
|
||||
$BuildNumber
|
||||
)
|
||||
|
||||
# Errors are handled explicitly. Otherwise any output to stderr when
|
||||
# calling classic Windows exes causes a script error.
|
||||
$ErrorActionPreference = 'Continue'
|
||||
|
||||
If (-Not $BuildNumber) {
|
||||
$BuildNumber = 0
|
||||
}
|
||||
|
||||
@@ -7,6 +7,10 @@ Param(
|
||||
$BuildNumber
|
||||
)
|
||||
|
||||
# Errors are handled explicitly. Otherwise any output to stderr when
|
||||
# calling classic Windows exes causes a script error.
|
||||
$ErrorActionPreference = 'Continue'
|
||||
|
||||
If (-Not $BuildNumber) {
|
||||
$BuildNumber = 0
|
||||
}
|
||||
|
||||
39
scripts/package/win-setup.ps1
Normal file
39
scripts/package/win-setup.ps1
Normal file
@@ -0,0 +1,39 @@
|
||||
Param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[String]
|
||||
$DiscidVersion,
|
||||
[Parameter(Mandatory=$true)]
|
||||
[String]
|
||||
$FpcalVersion
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
Function DownloadFile {
|
||||
Param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[String]
|
||||
$FileName,
|
||||
[Parameter(Mandatory=$true)]
|
||||
[String]
|
||||
$Url
|
||||
)
|
||||
$OutputPath = (Join-Path (Resolve-Path .) $FileName)
|
||||
(New-Object System.Net.WebClient).DownloadFile($Url, "$OutputPath")
|
||||
}
|
||||
|
||||
New-Item -Name .\build -ItemType Directory -ErrorAction Ignore
|
||||
|
||||
$ArchiveFile = ".\build\libdiscid.zip"
|
||||
Write-Output "Downloading libdiscid to $ArchiveFile..."
|
||||
DownloadFile -Url "https://github.com/metabrainz/libdiscid/releases/download/v$DiscidVersion/libdiscid-$DiscidVersion-win64.zip" `
|
||||
-FileName $ArchiveFile
|
||||
Expand-Archive -Path $ArchiveFile -DestinationPath .\build\libdiscid -Force
|
||||
Copy-Item .\build\libdiscid\discid.dll .
|
||||
|
||||
$ArchiveFile = ".\build\fpcalc.zip"
|
||||
Write-Output "Downloading chromaprint-fpcalc to $ArchiveFile..."
|
||||
DownloadFile -Url "https://github.com/acoustid/chromaprint/releases/download/v$FpcalVersion/chromaprint-fpcalc-$FpcalVersion-windows-x86_64.zip" `
|
||||
-FileName $ArchiveFile
|
||||
Expand-Archive -Path $ArchiveFile -DestinationPath .\build\fpcalc -Force
|
||||
Copy-Item .\build\fpcalc\chromaprint-fpcalc-$FpcalVersion-windows-x86_64\fpcalc.exe .
|
||||
Reference in New Issue
Block a user