mirror of
https://github.com/fergalmoran/picard.git
synced 2026-01-06 08:34:01 +00:00
Fixes issues with builds not running on macOS 10.12 as the Python available on GHA is working only with macOS 10.13 and later.
217 lines
7.6 KiB
YAML
217 lines
7.6 KiB
YAML
name: Package and release
|
|
|
|
on:
|
|
push:
|
|
paths:
|
|
- '.github/workflows/package.yml'
|
|
- 'installer/**'
|
|
- 'picard/**'
|
|
- 'po/**.po'
|
|
- 'resources/win10/**'
|
|
- 'scripts/package/*'
|
|
- 'scripts/pyinstaller/*'
|
|
- 'appxmanifest.xml.in'
|
|
- 'picard.icns'
|
|
- 'picard.ico'
|
|
- 'picard.spec'
|
|
- 'requirements*.txt'
|
|
- 'setup.py'
|
|
- 'tagger.py.in'
|
|
- 'win.version-info.txt.in'
|
|
pull_request:
|
|
|
|
jobs:
|
|
package-macos:
|
|
runs-on: macos-latest
|
|
env:
|
|
DISCID_VERSION: 0.6.2
|
|
FPCALC_VERSION: 1.4.4-9
|
|
PYTHON_VERSION: 3.7.6
|
|
steps:
|
|
- uses: actions/checkout@v1
|
|
- name: Cache libdiscid
|
|
uses: actions/cache@v1
|
|
with:
|
|
path: ~/libdiscid
|
|
key: ${{ runner.os }}-libdiscid-${{ env.DISCID_VERSION }}
|
|
- name: Setup macOS build environment
|
|
run: |
|
|
./scripts/package/macos-setup.sh
|
|
echo "::add-path::/Library/Frameworks/Python.framework/Versions/3.7/bin"
|
|
mkdir artifacts
|
|
- name: Patch build version
|
|
if: startsWith(github.ref, 'refs/tags/') != true
|
|
run: |
|
|
python3 setup.py patch_version --platform=$(git rev-list --count HEAD).$(git rev-parse --short HEAD)
|
|
- name: Install dependencies
|
|
run: |
|
|
python3 -m pip install --upgrade pip setuptools wheel
|
|
pip3 install -r requirements-build.txt
|
|
pip3 install -r requirements-macos.txt
|
|
- name: Run tests
|
|
run: |
|
|
python3 setup.py test
|
|
- name: Build macOS app
|
|
run: |
|
|
./scripts/package/macos-package-app.sh
|
|
mv dist/*.dmg artifacts/
|
|
env:
|
|
APPLE_ID_USER: ${{ secrets. APPLE_ID_USER }}
|
|
APPLE_ID_PASSWORD: ${{ secrets. APPLE_ID_PASSWORD }}
|
|
encrypted_be5fb2212036_key: ${{ secrets.CODESIGN_MACOS_ENCRYPTED_KEY }}
|
|
encrypted_be5fb2212036_iv: ${{ secrets.CODESIGN_MACOS_ENCRYPTED_IV }}
|
|
appledev_p12_password: ${{ secrets.CODESIGN_MACOS_P12_PASSWORD }}
|
|
- name: Archive production artifacts
|
|
uses: actions/upload-artifact@v1
|
|
if: always()
|
|
with:
|
|
name: macos-app
|
|
path: artifacts/
|
|
|
|
package-windows:
|
|
runs-on: windows-latest
|
|
strategy:
|
|
matrix:
|
|
type:
|
|
- store-app
|
|
- signed-app
|
|
- installer
|
|
- portable
|
|
fail-fast: false
|
|
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
|
|
Write-Output "::add-path::C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x64"
|
|
Write-Output "::set-env name=BUILD_NUMBER::$(git rev-list --count HEAD)"
|
|
New-Item -Name .\artifacts -ItemType Directory
|
|
env:
|
|
DISCID_VERSION: 0.6.2
|
|
FPCALC_VERSION: 1.4.4-9
|
|
- name: Patch build version
|
|
if: startsWith(github.ref, 'refs/tags/') != true
|
|
run: |
|
|
python setup.py patch_version --platform=$Env:BUILD_NUMBER.$(git rev-parse --short HEAD)
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r requirements-build.txt
|
|
pip install -r requirements-win.txt
|
|
- name: Run tests
|
|
run: python setup.py test
|
|
- name: Prepare code signing certificate
|
|
if: matrix.type != 'store-app'
|
|
run: |
|
|
If ($Env:CODESIGN_PFX_URL -And $Env:AWS_ACCESS_KEY_ID) {
|
|
pip install awscli
|
|
aws s3 cp "$Env:CODESIGN_PFX_URL" .\codesign.pfx
|
|
Write-Output "::set-env name=CODESIGN::1"
|
|
} Else {
|
|
Write-Output "::warning::No code signing certificate available, skipping code signing."
|
|
}
|
|
env:
|
|
AWS_DEFAULT_REGION: eu-central-1
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
CODESIGN_PFX_URL: ${{ secrets.CODESIGN_PFX_URL }}
|
|
- name: Build Windows 10 store app package
|
|
if: matrix.type == 'store-app'
|
|
run: |
|
|
& .\scripts\package\win-package-appx.ps1 -BuildNumber $Env:BUILD_NUMBER
|
|
Move-Item .\dist\*.msix .\artifacts
|
|
env:
|
|
PICARD_APPX_PUBLISHER: CN=0A9169B7-05A3-4ED9-8876-830F17846709
|
|
- name: Build Windows 10 signed app package
|
|
if: matrix.type == 'signed-app' && env.CODESIGN == '1'
|
|
run: |
|
|
& .\scripts\package\win-package-appx.ps1 -BuildNumber $Env:BUILD_NUMBER -CertificateFile .\codesign.pfx -CertificatePassword $Env:CODESIGN_PFX_PASSWORD
|
|
Move-Item .\dist\*.msix .\artifacts
|
|
env:
|
|
CODESIGN_PFX_PASSWORD: ${{ secrets.CODESIGN_PFX_PASSWORD }}
|
|
- name: Build Windows installer
|
|
if: matrix.type == 'installer'
|
|
run: |
|
|
# choco install nsis
|
|
If ($Env:CODESIGN) {
|
|
$CertPassword = ConvertTo-SecureString -String $Env:CODESIGN_PFX_PASSWORD -Force -AsPlainText
|
|
$Certificate = Get-PfxCertificate -FilePath .\codesign.pfx -Password $CertPassword
|
|
& .\scripts\package\win-package-installer.ps1 -BuildNumber $Env:BUILD_NUMBER -Certificate $Certificate
|
|
} Else {
|
|
& .\scripts\package\win-package-installer.ps1 -BuildNumber $Env:BUILD_NUMBER
|
|
}
|
|
Move-Item .\installer\*.exe .\artifacts
|
|
dist\picard\fpcalc -version
|
|
env:
|
|
CODESIGN_PFX_PASSWORD: ${{ secrets.CODESIGN_PFX_PASSWORD }}
|
|
- name: Build Windows portable app
|
|
if: matrix.type == 'portable'
|
|
run: |
|
|
If ($Env:CODESIGN) {
|
|
$CertPassword = ConvertTo-SecureString -String $Env:CODESIGN_PFX_PASSWORD -Force -AsPlainText
|
|
$Certificate = Get-PfxCertificate -FilePath .\codesign.pfx -Password $CertPassword
|
|
& .\scripts\package\win-package-portable.ps1 -BuildNumber $Env:BUILD_NUMBER -Certificate $Certificate
|
|
} Else {
|
|
& .\scripts\package\win-package-portable.ps1 -BuildNumber $Env:BUILD_NUMBER
|
|
}
|
|
Move-Item .\dist\*.exe .\artifacts
|
|
env:
|
|
CODESIGN_PFX_PASSWORD: ${{ secrets.CODESIGN_PFX_PASSWORD }}
|
|
- name: Archive production artifacts
|
|
uses: actions/upload-artifact@v1
|
|
if: matrix.type != 'signed-app' || env.CODESIGN == '1'
|
|
with:
|
|
name: windows-${{ matrix.type }}
|
|
path: artifacts/
|
|
|
|
github-release:
|
|
runs-on: ubuntu-latest
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
needs:
|
|
- package-macos
|
|
- package-windows
|
|
steps:
|
|
- uses: actions/checkout@v1
|
|
- uses: actions/setup-python@v1
|
|
with:
|
|
python-version: 3.8
|
|
- uses: actions/download-artifact@v1
|
|
with:
|
|
name: macos-app
|
|
path: artifacts/
|
|
- uses: actions/download-artifact@v1
|
|
with:
|
|
name: windows-signed-app
|
|
path: artifacts/
|
|
- uses: actions/download-artifact@v1
|
|
with:
|
|
name: windows-store-app
|
|
path: artifacts/
|
|
- uses: actions/download-artifact@v1
|
|
with:
|
|
name: windows-installer
|
|
path: artifacts/
|
|
- uses: actions/download-artifact@v1
|
|
with:
|
|
name: windows-portable
|
|
path: artifacts/
|
|
- name: Prepare changelog
|
|
id: changelog
|
|
continue-on-error: true
|
|
run: |
|
|
PICARD_VERSION=$(python -c "import picard; print(picard.__version__)")
|
|
echo "::set-output name=version::"$PICARD_VERSION
|
|
./scripts/tools/changelog-for-version.py $PICARD_VERSION > changes-$PICARD_VERSION.txt
|
|
- name: Create release
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
name: MusicBrainz Picard ${{ steps.changelog.outputs.version }}
|
|
body_path: changes-${{ steps.changelog.outputs.version }}.txt
|
|
files: artifacts/*
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|