build: Get rid of "CI_COMMIT_TAG" in favor of GIMP_* vars from config.h

This makes the scripts more consistent and easier to understand.
This commit is contained in:
Bruno 2025-02-10 12:42:50 -03:00
parent 0c1d11dc86
commit 131834d34f
No known key found for this signature in database
3 changed files with 49 additions and 41 deletions

View File

@ -25,7 +25,7 @@ if [ -f "*appimagetool*.AppImage" ]; then
fi
if [ "$GITLAB_CI" ]; then
apt-get update >/dev/null 2>&1
apt-get install -y --no-install-recommends ca-certificates wget curl git >/dev/null 2>&1
apt-get install -y --no-install-recommends ca-certificates wget curl >/dev/null 2>&1
fi
export HOST_ARCH=$(uname -m)
export APPIMAGE_EXTRACT_AND_RUN=1
@ -86,19 +86,29 @@ if [ ! -f "$BUILD_DIR/config.h" ]; then
exit 1
fi
## Get info about GIMP version
GIMP_VERSION=$(grep GIMP_VERSION $BUILD_DIR/config.h | head -1 | sed 's/^.*"\([^"]*\)"$/\1/')
GIMP_APP_VERSION=$(grep GIMP_APP_VERSION $BUILD_DIR/config.h | head -1 | sed 's/^.*"\([^"]*\)"$/\1/')
## Figure out if GIMP is unstable
grep -q '#define GIMP_UNSTABLE' $BUILD_DIR/config.h && export GIMP_UNSTABLE=1
if [ "$CI_COMMIT_TAG" != "$(git describe --all | sed 's|tags/||')" ] && [ "$GIMP_UNSTABLE" ] || [[ "$GIMP_VERSION" =~ 'git' ]]; then
grep -q '#define GIMP_RC_VERSION' $BUILD_DIR/config.h && export GIMP_RC_VERSION=1
grep -q '#define GIMP_IS_RC_GIT' $BUILD_DIR/config.h && export GIMP_IS_RC_GIT=1
grep -q '#define GIMP_RELEASE' $BUILD_DIR/config.h && export GIMP_RELEASE=1
## Set proper AppImage update channel and App ID
if [ -z "$GIMP_RELEASE" ] && [ "$GIMP_UNSTABLE" ] || [ "$GIMP_IS_RC_GIT" ]; then
export CHANNEL="Continuous"
elif [ "$CI_COMMIT_TAG" = "$(git describe --all | sed 's|tags/||')" ] && [ "$GIMP_UNSTABLE" ] || [[ "$GIMP_VERSION" =~ 'RC' ]]; then
elif [ "$GIMP_RELEASE" ] && [ "$GIMP_UNSTABLE" ] || [ "$GIMP_RC_VERSION" ]; then
export CHANNEL="Pre"
else
export CHANNEL="Stable"
fi
export APP_ID="org.gimp.GIMP.$CHANNEL"
echo "(INFO): App ID: $APP_ID | Version: $GIMP_VERSION"
## Get info about GIMP version
GIMP_VERSION=$(grep GIMP_VERSION $BUILD_DIR/config.h | head -1 | sed 's/^.*"\([^"]*\)"$/\1/')
GIMP_APP_VERSION=$(grep GIMP_APP_VERSION $BUILD_DIR/config.h | head -1 | sed 's/^.*"\([^"]*\)"$/\1/')
if [[ "$GIMP_CI_APPIMAGE" =~ [1-9] ]] && [ "$CI_PIPELINE_SOURCE" != 'schedule' ]; then
export REVISION="-$GIMP_CI_APPIMAGE"
fi
echo "(INFO): App ID: $APP_ID | Version: ${GIMP_VERSION}${REVISION}"
echo -e "\e[0Ksection_end:`date +%s`:apmg_info\r\e[0K"
@ -418,16 +428,16 @@ echo -e "\e[0Ksection_end:`date +%s`:${ARCH}_source\r\e[0K"
# 5. CONSTRUCT .APPIMAGE
APPIMAGETOOL_APP_NAME="GIMP-${GIMP_VERSION}-${ARCH}.AppImage"
APPIMAGETOOL_APP_NAME="GIMP-${GIMP_VERSION}${REVISION}-${ARCH}.AppImage"
echo -e "\e[0Ksection_start:`date +%s`:${ARCH}_making[collapsed=true]\r\e[0KSquashing $APPIMAGETOOL_APP_NAME"
#updateinformation is not compatible with our server. See: https://github.com/AppImage/appimagetool/issues/91
#if [ "$CI_COMMIT_TAG" = "$(git describe --all | sed 's|tags/||')" ]; then
#if [ "$GIMP_RELEASE" ] && [ -z "$GIMP_IS_RC_GIT" ]; then
# update_info="--updateinformation zsync|https://download.gimp.org/gimp/v{$GIMP_APP_VERSION}/linux/GIMP-${CHANNEL}-${ARCH}.AppImage.zsync"
#fi
"./$standard_appimagetool" $APP_DIR $APPIMAGETOOL_APP_NAME --exclude-file appimageignore-$ARCH \
--runtime-file runtime-$ARCH $update_info
file "./$APPIMAGETOOL_APP_NAME"
#if [ "$CI_COMMIT_TAG" = "$(git describe --all | sed 's|tags/||')" ]; then
#if [ "$GIMP_RELEASE" ] && [ -z "$GIMP_IS_RC_GIT" ]; then
# mv ${APPIMAGETOOL_APP_NAME}.zsync GIMP-${CHANNEL}-${ARCH}.AppImage.zsync
#fi
echo -e "\e[0Ksection_end:`date +%s`:${ARCH}_making\r\e[0K"
@ -435,11 +445,11 @@ echo -e "\e[0Ksection_end:`date +%s`:${ARCH}_making\r\e[0K"
# 6. GENERATE SHASUMS
echo -e "\e[0Ksection_start:`date +%s`:${ARCH}_trust[collapsed=true]\r\e[0KChecksumming $APPIMAGETOOL_APP_NAME"
if [ "$CI_COMMIT_TAG" = "$(git describe --all | sed 's|tags/||')" ]; then
if [ "$GIMP_RELEASE" ] && [ -z "$GIMP_IS_RC_GIT" ]; then
sha256sum $APPIMAGETOOL_APP_NAME > $APPIMAGETOOL_APP_NAME.SHA256SUMS
fi
echo "(INFO): $APPIMAGETOOL_APP_NAME SHA-256: $(sha256sum $APPIMAGETOOL_APP_NAME | cut -d ' ' -f 1)"
if [ "$CI_COMMIT_TAG" = "$(git describe --all | sed 's|tags/||')" ]; then
if [ "$GIMP_RELEASE" ] && [ -z "$GIMP_IS_RC_GIT" ]; then
sha512sum $APPIMAGETOOL_APP_NAME > $APPIMAGETOOL_APP_NAME.SHA512SUMS
fi
echo "(INFO): $APPIMAGETOOL_APP_NAME SHA-512: $(sha512sum $APPIMAGETOOL_APP_NAME | cut -d ' ' -f 1)"

View File

@ -64,6 +64,10 @@ if (-not (Test-Path "$CONFIG_PATH"))
exit 1
}
## Figure out if a release is being done
if (Get-Content "$CONFIG_PATH" | Select-String '#define GIMP_IS_RC_GIT') { $GIMP_IS_RC_GIT='1' }
if (Get-Content "$CONFIG_PATH" | Select-String '#define GIMP_RELEASE') { $GIMP_RELEASE='1' }
## Get CUSTOM_GIMP_VERSION (GIMP version as we display for users in installer)
$CUSTOM_GIMP_VERSION = Get-Content "$CONFIG_PATH" | Select-String 'GIMP_VERSION' |
Foreach-Object {$_ -replace '#define GIMP_VERSION "',''} | Foreach-Object {$_ -replace '"',''}
@ -255,14 +259,14 @@ Write-Output "$([char]27)[0Ksection_start:$(Get-Date -UFormat %s -Millisecond 0)
## (We use .NET directly because 'sha*sum' does NOT support BOM from pre-PS6 'Set-Content')
$Utf8NoBomEncoding = New-Object -TypeName System.Text.UTF8Encoding -ArgumentList $False
$sha256 = (Get-FileHash $INSTALLER -Algorithm SHA256 | Select-Object -ExpandProperty Hash).ToLower()
if ($CI_COMMIT_TAG)
if ($GIMP_RELEASE -and -not $GIMP_IS_RC_GIT)
{
[System.IO.File]::WriteAllText("$GIMP_BASE\$INSTALLER.SHA256SUMS", "$sha256 *$INSTALLER", $Utf8NoBomEncoding)
#Set-Content $INSTALLER.SHA256SUMS "$sha256 *$INSTALLER" -Encoding utf8NoBOM -NoNewline
}
Write-Output "(INFO): $INSTALLER SHA-256: $sha256"
$sha512 = (Get-FileHash $INSTALLER -Algorithm SHA512 | Select-Object -ExpandProperty Hash).ToLower()
if ($CI_COMMIT_TAG)
if ($GIMP_RELEASE -and -not $GIMP_IS_RC_GIT)
{
[System.IO.File]::WriteAllText("$GIMP_BASE\$INSTALLER.SHA512SUMS", "$sha512 *$INSTALLER", $Utf8NoBomEncoding)
#Set-Content $INSTALLER.SHA512SUMS "$sha512 *$INSTALLER" -Encoding utf8NoBOM -NoNewline

View File

@ -67,19 +67,14 @@ if (-not (Test-Path "$config_path"))
exit 1
}
$gimp_version = Get-Content "$config_path" | Select-String 'GIMP_VERSION' |
Foreach-Object {$_ -replace '#define GIMP_VERSION "',''} | Foreach-Object {$_ -replace '"',''}
## Figure out if GIMP is unstable (dev version)
$gimp_unstable = Get-Content "$config_path" | Select-String 'GIMP_UNSTABLE' |
Foreach-Object {$_ -replace '#define GIMP_UNSTABLE ',''}
if ($gimp_unstable -eq '1' -or $gimp_version -match 'RC[0-9]')
{
$dev = $true
}
if (Get-Content "$config_path" | Select-String '#define GIMP_UNSTABLE') { $GIMP_UNSTABLE='1' }
if (Get-Content "$config_path" | Select-String '#define GIMP_RC_VERSION') { $GIMP_RC_VERSION='1' }
if (Get-Content "$config_path" | Select-String '#define GIMP_IS_RC_GIT') { $GIMP_IS_RC_GIT='1' }
if (Get-Content "$config_path" | Select-String '#define GIMP_RELEASE') { $GIMP_RELEASE='1' }
## Get Identity Name (the dir shown in Explorer)
if ($dev)
if ($GIMP_UNSTABLE -or $GIMP_RC_VERSION)
{
$IDENTITY_NAME="GIMP.GIMPPreview"
}
@ -88,20 +83,22 @@ else
$IDENTITY_NAME="GIMP.GIMP"
}
## Get GIMP app version (major.minor)
## 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)
$gimp_version = Get-Content "$config_path" | Select-String 'GIMP_VERSION' |
Foreach-Object {$_ -replace '#define GIMP_VERSION "',''} | Foreach-Object {$_ -replace '"',''}
### 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
### Get GIMP micro version
$micro = ($gimp_version.Split('.'))[-1] -replace '(.+?)-.+','$1'
if ($micro -ne '0')
{
$micro_digit = $micro
}
## Get GIMP revision
### Get GIMP revision
if ($revision -match '[1-9]' -and $CI_PIPELINE_SOURCE -ne 'schedule')
{
$revision = $revision -replace 'MSIXUPLOAD_',''
@ -117,9 +114,6 @@ else
$wack = "$revision"
$revision = "0"
}
## 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}${revision}.0"
Write-Output "(INFO): Identity: $IDENTITY_NAME | Version: $CUSTOM_GIMP_VERSION (major: $major, minor: $minor, micro: ${micro}${revision_text})"
@ -200,7 +194,7 @@ foreach ($bundle in $supported_archs)
(Get-Content $msix_arch\AppxManifest.xml) | Foreach-Object {$_ -replace "@IDENTITY_NAME@","$IDENTITY_NAME"} |
Set-Content $msix_arch\AppxManifest.xml
### Set Display Name (the name shown in MS Store)
if ($dev)
if ($GIMP_UNSTABLE -or $GIMP_RC_VERSION)
{
$display_name='GIMP (Preview)'
}
@ -214,7 +208,7 @@ foreach ($bundle in $supported_archs)
(Get-Content $msix_arch\AppxManifest.xml) | Foreach-Object {$_ -replace "@CUSTOM_GIMP_VERSION@","$CUSTOM_GIMP_VERSION"} |
Set-Content $msix_arch\AppxManifest.xml
### Set GIMP mutex version (major.minor or major)
if ($dev -and ($gimp_version -notmatch 'RC[0-9]'))
if ($GIMP_UNSTABLE)
{
$gimp_mutex_version="$gimp_app_version"
}
@ -264,7 +258,7 @@ foreach ($bundle in $supported_archs)
}
## Disable Update check (ONLY FOR RELEASES)
if ($CI_COMMIT_TAG -match 'GIMP_[0-9]*_[0-9]*_[0-9]*' -or $GIMP_CI_MS_STORE -like 'MSIXUPLOAD*')
if ($GIMP_RELEASE -and -not $GIMP_IS_RC_GIT)
{
Add-Content "$vfs\share\gimp\*\gimp-release" 'check-update=false'
}
@ -280,7 +274,7 @@ foreach ($bundle in $supported_archs)
## Make .appxsym for each msix_arch (ONLY FOR RELEASES)
$APPXSYM = "${IDENTITY_NAME}_${CUSTOM_GIMP_VERSION}_$msix_arch.appxsym"
#if ($CI_COMMIT_TAG -match 'GIMP_[0-9]*_[0-9]*_[0-9]*' -or $GIMP_CI_MS_STORE -like 'MSIXUPLOAD*')
#if ($GIMP_RELEASE -and -not $GIMP_IS_RC_GIT)
# {
# Get-ChildItem $msix_arch -Filter *.pdb -Recurse |
# Compress-Archive -DestinationPath "${IDENTITY_NAME}_${CUSTOM_GIMP_VERSION}_$msix_arch.zip"
@ -303,7 +297,7 @@ if (((Test-Path $a64_bundle) -and (Test-Path $x64_bundle)) -and (Get-ChildItem *
{
$MSIXBUNDLE = "${IDENTITY_NAME}_${CUSTOM_GIMP_VERSION}_neutral.msixbundle"
$MSIX_ARTIFACT = "$MSIXBUNDLE"
if ($CI_COMMIT_TAG -match 'GIMP_[0-9]*_[0-9]*_[0-9]*' -or $GIMP_CI_MS_STORE -like 'MSIXUPLOAD*')
if ($GIMP_RELEASE -and -not $GIMP_IS_RC_GIT)
{
$MSIXUPLOAD = "${IDENTITY_NAME}_${CUSTOM_GIMP_VERSION}_x64_arm64_bundle.msixupload"
$MSIX_ARTIFACT = "$MSIXUPLOAD"
@ -319,7 +313,7 @@ if (((Test-Path $a64_bundle) -and (Test-Path $x64_bundle)) -and (Get-ChildItem *
Remove-Item _TempOutput/ -Recurse
## Make .msixupload (ONLY FOR RELEASES)
if ($CI_COMMIT_TAG -match 'GIMP_[0-9]*_[0-9]*_[0-9]*' -or $GIMP_CI_MS_STORE -like 'MSIXUPLOAD*')
if ($GIMP_RELEASE -and -not $GIMP_IS_RC_GIT)
{
Get-ChildItem *.msixbundle | ForEach-Object { Compress-Archive -Path "$($_.Basename).msixbundle" -DestinationPath "$($_.Basename).zip" }
Get-ChildItem *.zip | Rename-Item -NewName $MSIXUPLOAD
@ -390,7 +384,7 @@ if (-not $GITLAB_CI -and $wack -eq 'WACK')
# 6.B. SIGN .MSIX OR .MSIXBUNDLE PACKAGE (NOT THE BINARIES)
# (Partner Center does the same thing, for free, before publishing)
if ($CI_COMMIT_TAG -notmatch 'GIMP_[0-9]*_[0-9]*_[0-9]*' -and $GIMP_CI_MS_STORE -notlike 'MSIXUPLOAD*' -and $MSIX_ARTIFACT -notlike "*msixupload")
if (-not $GIMP_RELEASE -or $GIMP_IS_RC_GIT)
{
Write-Output "$([char]27)[0Ksection_start:$(Get-Date -UFormat %s -Millisecond 0):msix_trust${msix_arch}[collapsed=true]$([char]13)$([char]27)[0KSelf-signing $MSIX_ARTIFACT (for testing purposes)"
signtool sign /debug /fd sha256 /a /f $(Resolve-Path build\windows\store\pseudo-gimp*.pfx) /p eek $MSIX_ARTIFACT
@ -416,7 +410,7 @@ if ($GITLAB_CI)
$OUTPUT_DIR = "$PWD\build\windows\store\_Output"
New-Item $OUTPUT_DIR -ItemType Directory -Force | Out-Null
Move-Item $MSIX_ARTIFACT $OUTPUT_DIR -Force
if ($CI_COMMIT_TAG -notmatch 'GIMP_[0-9]*_[0-9]*_[0-9]*' -and $GIMP_CI_MS_STORE -notlike 'MSIXUPLOAD*' -and $MSIX_ARTIFACT -notlike "*msixupload")
if (-not $GIMP_RELEASE -or $GIMP_IS_RC_GIT)
{
Copy-Item pseudo-gimp.pfx $OUTPUT_DIR
}
@ -432,7 +426,7 @@ if ("$CI_COMMIT_TAG" -eq (git describe --all | Foreach-Object {$_ -replace 'tags
msstore reconfigure --tenantId $TENANT_ID --sellerId $SELLER_ID --clientId $CLIENT_ID --clientSecret $CLIENT_SECRET
## Set product_id (which is not confidential) needed by HTTP calls of some commands
if ($dev)
if ($GIMP_UNSTABLE -or $GIMP_RC_VERSION)
{
$PRODUCT_ID="9NZVDVP54JMR"
}