build/windows: Prepare MSIX versioning to RC1 and beyond

First, make the script versioning system able to detect release candidates.
Otherwise, we willn't be able to use the "GIMP.GIMPPreview" identity (that
was previously tied to GIMP_UNSTABLE var, which is not set to 1 on RCs).

---

This also fixes the pseudo-revision trick when we have a zeroed micro version,
which is the case of the release candidates and the first stable version.
The versioning now have a different aproach from 8c99efd7.
This commit is contained in:
Bruno 2024-08-20 18:59:27 -03:00
parent 90e96d800b
commit 60add9ac40
2 changed files with 66 additions and 15 deletions

View File

@ -33,10 +33,23 @@ if (-not (Test-Path "$config_path"))
exit 1
}
## Get Identity Name (the dir shown in Explorer)
$GIMP_UNSTABLE = Get-Content "$config_path" | Select-String 'GIMP_UNSTABLE' |
## Figure out if GIMP is unstable (dev)
$gimp_unstable = Get-Content "$config_path" | Select-String 'GIMP_UNSTABLE' |
Foreach-Object {$_ -replace '#define GIMP_UNSTABLE ',''}
if ($GIMP_UNSTABLE -eq '1')
if ($gimp_unstable -eq '1')
{
$dev = '1'
}
$gimp_version = Get-Content "$config_path" | Select-String 'GIMP_VERSION' |
Foreach-Object {$_ -replace '#define GIMP_VERSION "',''} | Foreach-Object {$_ -replace '"',''}
if ($gimp_version -match 'RC[0-9]')
{
$dev = 'rc'
}
## Get Identity Name (the dir shown in Explorer)
if ($dev)
{
$IDENTITY_NAME="GIMP.GIMPPreview"
}
@ -48,31 +61,39 @@ else
## Get GIMP app version (major.minor)
$GIMP_APP_VERSION = Get-Content "$config_path" | Select-String 'GIMP_APP_VERSION "' |
Foreach-Object {$_ -replace '#define GIMP_APP_VERSION "',''} | Foreach-Object {$_ -replace '"',''}
$major = ($GIMP_APP_VERSION.Split('.'))[0]
$minor = ($GIMP_APP_VERSION.Split('.'))[-1]
## Get GIMP micro version
$gimp_version = Get-Content "$config_path" | Select-String 'GIMP_VERSION' |
Foreach-Object {$_ -replace '#define GIMP_VERSION "',''} | Foreach-Object {$_ -replace '"',''}
$micro = $gimp_version -replace "$GIMP_APP_VERSION.",""
if (($micro).tostring().length -eq 1)
$micro = ($gimp_version.Split('.'))[-1]
if ($dev -eq 'rc')
{
$micro_digit = '0'
$micro = $micro -replace ".{4}$"
}
$micro_digit = $micro
if ($micro -eq '0')
{
$micro_digit = ''
}
## Get GIMP revision
if ($GIMP_CI_MS_STORE -like 'MSIXUPLOAD_*')
{
Write-Host "(WARNING): The revision is being made on CI, more updated deps than necessary may be packaged." -ForegroundColor yellow
$revision = $GIMP_CI_MS_STORE -replace 'MSIXUPLOAD_',''
}
if (($revision).tostring().length -eq 1)
if ($revision -ne '0')
{
$revision_digit = '0'
$revision_text = ", revision: $revision"
}
## Get custom GIMP version (major.minor.micro+revision.0), a compliant way to publish to Partner Center:
## https://learn.microsoft.com/en-us/windows/apps/publish/publish-your-app/msix/app-package-requirements)
$CUSTOM_GIMP_VERSION = "$GIMP_APP_VERSION.${micro_digit}${micro}${revision_digit}${revision}.0"
$CUSTOM_GIMP_VERSION = "$GIMP_APP_VERSION.${micro_digit}${revision}.0"
Write-Output "(INFO): Identity: $IDENTITY_NAME | Version: $CUSTOM_GIMP_VERSION"
Write-Output "(INFO): Identity: $IDENTITY_NAME | Version: $CUSTOM_GIMP_VERSION (major: $major, minor: $minor, micro: ${micro}${revision_text})"
# Autodetects what arch bundles will be packaged
@ -127,7 +148,7 @@ foreach ($bundle in $supported_archs)
Set-Content $msix_arch\AppxManifest.xml
## Set Display Name (the name shown in MS Store)
if ($GIMP_UNSTABLE -eq '1')
if ($dev)
{
$display_name='GIMP (Preview)'
}
@ -203,10 +224,9 @@ foreach ($bundle in $supported_archs)
# 4. MAKE .MSIX AND CORRESPONDING .APPXSYM
$MSIX_ARTIFACT = "${IDENTITY_NAME}_${CUSTOM_GIMP_VERSION}_$msix_arch.msix"
$APPXSYM = $MSIX_ARTIFACT -replace '.msix','.appxsym'
## Make .appxsym for each msix_arch (ONLY FOR RELEASES)
$APPXSYM = "${IDENTITY_NAME}_${CUSTOM_GIMP_VERSION}_$msix_arch.appxsym"
#if ($CI_COMMIT_TAG -or ($GIMP_CI_MS_STORE -like 'MSIXUPLOAD*'))
# {
# Get-ChildItem $msix_arch -Filter *.pdb -Recurse |
@ -216,6 +236,7 @@ foreach ($bundle in $supported_archs)
# }
## Make .msix from each msix_arch
$MSIX_ARTIFACT = $APPXSYM -replace '.appxsym','.msix'
if (-not ((Test-Path $a64_bundle) -and (Test-Path $x64_bundle)))
{
Write-Output "(INFO): packaging $MSIX_ARTIFACT (for testing purposes)"
@ -260,6 +281,8 @@ if (((Test-Path $a64_bundle) -and (Test-Path $x64_bundle)) -and (Get-ChildItem *
#Get-ChildItem *.appxsym | Remove-Item -Recurse -Force
Get-ChildItem *.msixbundle | Remove-Item -Recurse -Force
}
#FIXME: .msixupload should be published automatically
#https://gitlab.gnome.org/GNOME/gimp/-/issues/11397
}

View File

@ -0,0 +1,28 @@
# GIMP MSIX HowTo
## Development releases
The MS Store/Partner Center hosts our development point releases:
https://partner.microsoft.com/dashboard/products/9NZVDVP54JMR/overview
Base rule to update the "GIMP (Preview)" entry:
* Regularly, a .msixupload will be generated at each tagged commit. It also can be
with a custom pipeline valuating `GIMP_CI_MS_STORE` to `MSIXUPLOAD_${REVISION}`
## Maintaining the MSIX
1. The link above will open 'Partner Center', the frontend to submit .msixupload
2. With your Microsoft Entra ID account (@*onmicrosoft.com), log-in as costumary
3. Clicking on the "Start update" button will make possible to change some things.
Only 'Packages' and 'Store listings' sections are needed. On 'Packages' you will
add the generated .msixupload and on 'Store listings' the brief changelog.
## Versioning the MSIX
* Every new .msixupload submission (with different content) needs a bumped version.
But MS Store reserves revisions (the fourth digit after last dot) for its own use.
https://learn.microsoft.com/en-us/windows/apps/publish/publish-your-app/msix/app-package-requirements
So, our MSIX have a special micro versioning to we have revisions. Check the .ps1.