mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-08-11 19:52:10 +00:00
Optimized Flatpak workflow
This commit is contained in:
parent
1ce4b4f4fb
commit
40833a556f
58
.github/workflows/build-and-release.yml
vendored
58
.github/workflows/build-and-release.yml
vendored
@ -500,7 +500,7 @@ jobs:
|
||||
FLATPAK_COMMIT: ${{ needs.sync_flatpak_repo.outputs.flatpak_commit }}
|
||||
|
||||
steps:
|
||||
- name: Wait for Flatpak main build
|
||||
- name: Dispatch and wait for Flatpak build
|
||||
id: flatpak_run
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.FLATPAK_WORKFLOW_TOKEN }}
|
||||
@ -508,7 +508,7 @@ jobs:
|
||||
set -euo pipefail
|
||||
|
||||
find_run_id() {
|
||||
local created_after="${1:-}"
|
||||
local created_after="$1"
|
||||
local runs
|
||||
|
||||
runs=$(gh run list \
|
||||
@ -519,16 +519,10 @@ jobs:
|
||||
--limit 20 \
|
||||
--json databaseId,event,headSha,createdAt)
|
||||
|
||||
if [ -n "$created_after" ]; then
|
||||
echo "$runs" | jq -r \
|
||||
--arg commit "$FLATPAK_COMMIT" \
|
||||
--arg created_after "$created_after" \
|
||||
'[.[] | select(.headSha == $commit and .event == "workflow_dispatch" and .createdAt >= $created_after)][0].databaseId // empty'
|
||||
else
|
||||
echo "$runs" | jq -r \
|
||||
--arg commit "$FLATPAK_COMMIT" \
|
||||
'[.[] | select(.headSha == $commit and (.event == "push" or .event == "workflow_dispatch"))][0].databaseId // empty'
|
||||
fi
|
||||
echo "$runs" | jq -r \
|
||||
--arg commit "$FLATPAK_COMMIT" \
|
||||
--arg created_after "$created_after" \
|
||||
'[.[] | select(.headSha == $commit and .event == "workflow_dispatch" and .createdAt >= $created_after)][0].databaseId // empty'
|
||||
}
|
||||
|
||||
validate_required_artifacts() {
|
||||
@ -601,41 +595,29 @@ jobs:
|
||||
return 2
|
||||
}
|
||||
|
||||
current_main=$(gh api "repos/${FLATPAK_REPOSITORY}/commits/main" --jq .sha)
|
||||
if [ "$current_main" != "$FLATPAK_COMMIT" ]; then
|
||||
echo "Flatpak main advanced from ${FLATPAK_COMMIT} to ${current_main} before the build could be dispatched."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dispatch_started_at=$(date --utc +'%Y-%m-%dT%H:%M:%SZ')
|
||||
gh workflow run "$FLATPAK_WORKFLOW" \
|
||||
--repo "$FLATPAK_REPOSITORY" \
|
||||
--ref main \
|
||||
-f "artifact_retention_days=${RETENTION_INTERMEDIATE_ASSETS}"
|
||||
|
||||
run_id=""
|
||||
for attempt in {1..15}; do
|
||||
run_id=$(find_run_id)
|
||||
run_id=$(find_run_id "$dispatch_started_at")
|
||||
if [ -n "$run_id" ]; then
|
||||
break
|
||||
fi
|
||||
|
||||
echo "Waiting for Flatpak workflow on commit ${FLATPAK_COMMIT}..."
|
||||
echo "Waiting for the dispatched Flatpak workflow on commit ${FLATPAK_COMMIT}..."
|
||||
sleep 20
|
||||
done
|
||||
|
||||
if [ -z "$run_id" ]; then
|
||||
current_main=$(gh api "repos/${FLATPAK_REPOSITORY}/commits/main" --jq .sha)
|
||||
if [ "$current_main" != "$FLATPAK_COMMIT" ]; then
|
||||
echo "No Flatpak run exists for ${FLATPAK_COMMIT}, and Flatpak main has advanced to ${current_main}."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dispatch_started_at=$(date --utc +'%Y-%m-%dT%H:%M:%SZ')
|
||||
gh workflow run "$FLATPAK_WORKFLOW" \
|
||||
--repo "$FLATPAK_REPOSITORY" \
|
||||
--ref main \
|
||||
-f "artifact_retention_days=${RETENTION_INTERMEDIATE_ASSETS}"
|
||||
|
||||
for attempt in {1..15}; do
|
||||
run_id=$(find_run_id "$dispatch_started_at")
|
||||
if [ -n "$run_id" ]; then
|
||||
break
|
||||
fi
|
||||
|
||||
echo "Waiting for the dispatched Flatpak workflow on commit ${FLATPAK_COMMIT}..."
|
||||
sleep 20
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -z "$run_id" ]; then
|
||||
echo "Timed out waiting for a Flatpak workflow to start on commit ${FLATPAK_COMMIT}."
|
||||
exit 1
|
||||
|
||||
Loading…
Reference in New Issue
Block a user