diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 79b69cf..d2d2ee4 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -100,6 +100,24 @@ jobs: echo "project_name=$PRJ-$TARGET" echo "short_sha=$SHORT_SHA" } >> "$GITHUB_OUTPUT" + + # ⏳ Wait for Upstream Packages/Images if Tagged + if [[ "${{ github.ref_type }}" == "tag" ]]; then + echo "🔎 Checking for @mintel dependencies in package.json..." + # Extract any @mintel/ version (they should be synced in monorepo) + UPSTREAM_VERSION=$(grep -o '"@mintel/.*": "[^"]*"' package.json | head -1 | cut -d'"' -f4 | sed 's/\^//; s/\~//') + TAG_TO_WAIT="v$UPSTREAM_VERSION" + + if [[ -n "$UPSTREAM_VERSION" && "$UPSTREAM_VERSION" != "workspace:"* ]]; then + echo "⏳ This release depends on @mintel v$UPSTREAM_VERSION. Waiting for upstream build..." + # Fetch script from monorepo (main) + curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + "https://git.infra.mintel.me/mmintel/at-mintel/raw/branch/main/packages/infra/scripts/wait-for-upstream.sh" > wait-for-upstream.sh + chmod +x wait-for-upstream.sh + + GITEA_TOKEN=${{ secrets.GITHUB_TOKEN }} ./wait-for-upstream.sh "mmintel/at-mintel" "$TAG_TO_WAIT" + fi + fi else echo "target=skip" >> "$GITHUB_OUTPUT" fi