Skip to content

Commit 4bdbcc2

Browse files
committed
fix: Wait for OpenUPM publish to finish before triggering the next one
1 parent 89ba761 commit 4bdbcc2

1 file changed

Lines changed: 39 additions & 1 deletion

File tree

.github/workflows/PublishUnity3dPackage.yml

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,55 @@ jobs:
6767
env:
6868
GITHUB_TOKEN: ${{ secrets.OPENUPM_GITHUB_TOKEN }}
6969
run: |
70+
old_run_id=$(gh run list --repo PereViader/OpenUPM --workflow Publish.yml --limit 1 --json databaseId -q '.[0].databaseId')
71+
7072
gh workflow run Publish.yml \
7173
--repo PereViader/OpenUPM \
7274
--ref main \
7375
-f ingest_url=https://github.com/PereViader/ManualDi/releases/download/v${{ steps.get-version.outputs.version }}/com.pereviader.manualdi.sync.unity3d-${{ steps.get-version.outputs.version }}.tgz
7476
77+
echo "Waiting for workflow to start..."
78+
for i in {1..60}; do
79+
sleep 2
80+
new_run_id=$(gh run list --repo PereViader/OpenUPM --workflow Publish.yml --limit 1 --json databaseId -q '.[0].databaseId')
81+
if [ "$new_run_id" != "$old_run_id" ] && [ -n "$new_run_id" ]; then
82+
break
83+
fi
84+
done
85+
86+
if [ "$new_run_id" == "$old_run_id" ] || [ -z "$new_run_id" ]; then
87+
echo "Failed to start workflow or find run id"
88+
exit 1
89+
fi
90+
91+
echo "Watching workflow run $new_run_id"
92+
gh run watch $new_run_id --repo PereViader/OpenUPM --exit-status
93+
7594
- name: Trigger Async OpenUPM Publish
7695
if: ${{ steps.release-exists.outputs.exists == 'false' }}
7796
env:
7897
GITHUB_TOKEN: ${{ secrets.OPENUPM_GITHUB_TOKEN }}
7998
run: |
99+
old_run_id=$(gh run list --repo PereViader/OpenUPM --workflow Publish.yml --limit 1 --json databaseId -q '.[0].databaseId')
100+
80101
gh workflow run Publish.yml \
81102
--repo PereViader/OpenUPM \
82103
--ref main \
83-
-f ingest_url=https://github.com/PereViader/ManualDi/releases/download/v${{ steps.get-version.outputs.version }}/com.pereviader.manualdi.async.unity3d-${{ steps.get-version.outputs.version }}.tgz
104+
-f ingest_url=https://github.com/PereViader/ManualDi/releases/download/v${{ steps.get-version.outputs.version }}/com.pereviader.manualdi.async.unity3d-${{ steps.get-version.outputs.version }}.tgz
105+
106+
echo "Waiting for workflow to start..."
107+
for i in {1..60}; do
108+
sleep 2
109+
new_run_id=$(gh run list --repo PereViader/OpenUPM --workflow Publish.yml --limit 1 --json databaseId -q '.[0].databaseId')
110+
if [ "$new_run_id" != "$old_run_id" ] && [ -n "$new_run_id" ]; then
111+
break
112+
fi
113+
done
114+
115+
if [ "$new_run_id" == "$old_run_id" ] || [ -z "$new_run_id" ]; then
116+
echo "Failed to start workflow or find run id"
117+
exit 1
118+
fi
119+
120+
echo "Watching workflow run $new_run_id"
121+
gh run watch $new_run_id --repo PereViader/OpenUPM --exit-status

0 commit comments

Comments
 (0)