Skip to content

Commit adf62e1

Browse files
Rellobackportbot[bot]
authored andcommitted
fix(ci): derive Craft cache refs from config
fix(ci): derive Craft cache refs from config Read the pinned Craft revision and both blueprint refs from craftmaster.ini. Reuse the blueprint refs for repository setup and resolve their current commits for the cache key. Signed-off-by: Rello <github@scherello.de> Assisted-by: Codex:GPT-5 [skip ci]
1 parent 2d77486 commit adf62e1

1 file changed

Lines changed: 22 additions & 6 deletions

File tree

.github/workflows/windows-build-and-test.yml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,19 @@ jobs:
2626
id: craft-revisions
2727
shell: pwsh
2828
run: |
29+
function configValue($key) {
30+
$escapedKey = [regex]::Escape($key)
31+
$matches = @(Select-String -Path "${{ env.CRAFT_MASTER_CONFIG }}" -Pattern "^\s*$escapedKey\s*=\s*(.+?)\s*$")
32+
if($matches.Count -ne 1) {
33+
throw "Expected exactly one $key value in craftmaster.ini."
34+
}
35+
return $matches[0].Matches[0].Groups[1].Value.Trim()
36+
}
37+
38+
$craftRevision = configValue "CraftRevision"
39+
$kdeBlueprintRef = configValue "craft/craft-blueprints-kde.revision"
40+
$nextcloudBlueprintRef = configValue "craft/craft-blueprints-nextcloud.revision"
41+
2942
function remoteRevision($repository, $ref) {
3043
$revision = git ls-remote $repository $ref
3144
if($LASTEXITCODE -ne 0 -or !$revision) {
@@ -34,10 +47,13 @@ jobs:
3447
return ($revision -split '\s+')[0]
3548
}
3649
37-
$craftMasterRevision = remoteRevision "https://invent.kde.org/packaging/craftmaster.git" "HEAD"
38-
$kdeBlueprintRevision = remoteRevision "https://github.com/nextcloud/craft-blueprints-kde.git" "refs/heads/stable-34.0"
39-
$nextcloudBlueprintRevision = remoteRevision "https://github.com/nextcloud/craft-blueprints-nextcloud.git" "refs/heads/stable-34.0"
40-
"key=$craftMasterRevision-$kdeBlueprintRevision-$nextcloudBlueprintRevision" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
50+
$kdeBlueprintRevision = remoteRevision "https://github.com/nextcloud/craft-blueprints-kde.git" "refs/heads/$kdeBlueprintRef"
51+
$nextcloudBlueprintRevision = remoteRevision "https://github.com/nextcloud/craft-blueprints-nextcloud.git" "refs/heads/$nextcloudBlueprintRef"
52+
@(
53+
"kde_ref=$kdeBlueprintRef"
54+
"nextcloud_ref=$nextcloudBlueprintRef"
55+
"key=$craftRevision-$kdeBlueprintRevision-$nextcloudBlueprintRevision"
56+
) | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
4157
4258
- name: Restore Craft dependencies
4359
id: craft-cache
@@ -61,8 +77,8 @@ jobs:
6177
if($LASTEXITCODE -ne 0) {exit $LASTEXITCODE}
6278
}
6379
64-
craft --add-blueprint-repository "https://github.com/nextcloud/craft-blueprints-kde.git|stable-34.0|"
65-
craft --add-blueprint-repository "https://github.com/nextcloud/craft-blueprints-nextcloud.git|stable-34.0|"
80+
craft --add-blueprint-repository "https://github.com/nextcloud/craft-blueprints-kde.git|${{ steps.craft-revisions.outputs.kde_ref }}|"
81+
craft --add-blueprint-repository "https://github.com/nextcloud/craft-blueprints-nextcloud.git|${{ steps.craft-revisions.outputs.nextcloud_ref }}|"
6682
craft craft
6783
craft --install-deps nextcloud-client
6884

0 commit comments

Comments
 (0)