|
79 | 79 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
80 | 80 |
|
81 | 81 | - name: Push git tags |
82 | | - run: git push --tags |
| 82 | + run: | |
| 83 | + for dir in packages/core packages/dom packages/router packages/testing; do |
| 84 | + name=$(node -p "require('./$dir/package.json').name") |
| 85 | + version=$(node -p "require('./$dir/package.json').version") |
| 86 | + tag="$name@$version" |
| 87 | + remote_sha=$(git ls-remote --tags origin "refs/tags/$tag" | awk '{print $1}') |
| 88 | + if [ -n "$remote_sha" ]; then |
| 89 | + local_sha=$(git rev-list -n 1 "$tag" 2>/dev/null || echo "") |
| 90 | + if [ "$remote_sha" = "$local_sha" ]; then |
| 91 | + echo "⏭️ git tag $tag already exists at $remote_sha on remote, skipping" |
| 92 | + else |
| 93 | + echo "::error::git tag $tag exists on remote at $remote_sha but local is $local_sha" |
| 94 | + exit 1 |
| 95 | + fi |
| 96 | + else |
| 97 | + if ! git rev-parse "$tag" >/dev/null 2>&1; then |
| 98 | + git tag "$tag" |
| 99 | + echo "Created local tag $tag" |
| 100 | + fi |
| 101 | + git push origin "$tag" |
| 102 | + echo "✅ git tag $tag pushed" |
| 103 | + fi |
| 104 | + done |
83 | 105 |
|
84 | 106 | - name: Verify alpha dist-tags |
85 | 107 | run: | |
@@ -114,9 +136,22 @@ jobs: |
114 | 136 | name=$(node -p "require('./$dir/package.json').name") |
115 | 137 | version=$(node -p "require('./$dir/package.json').version") |
116 | 138 | tag="$name@$version" |
117 | | - if ! git ls-remote --exit-code --tags origin "refs/tags/$tag" 2>&1; then |
118 | | - echo "::error::git tag $tag not found on remote" |
| 139 | + attempt=0 |
| 140 | + max_attempts=25 |
| 141 | + while [ $attempt -lt $max_attempts ]; do |
| 142 | + attempt=$((attempt + 1)) |
| 143 | + if git ls-remote --exit-code --tags origin "refs/tags/$tag" >/dev/null 2>&1; then |
| 144 | + remote_sha=$(git ls-remote --tags origin "refs/tags/$tag" | awk '{print $1}') |
| 145 | + echo "✅ $tag found on remote at $remote_sha (attempt $attempt)" |
| 146 | + break |
| 147 | + fi |
| 148 | + echo "Attempt $attempt: $tag not yet found on remote" |
| 149 | + if [ $attempt -lt $max_attempts ]; then |
| 150 | + sleep $((RANDOM % 6 + 10)) |
| 151 | + fi |
| 152 | + done |
| 153 | + if ! git ls-remote --exit-code --tags origin "refs/tags/$tag" >/dev/null 2>&1; then |
| 154 | + echo "::error::git tag $tag not found on remote (after $max_attempts attempts)" |
119 | 155 | exit 1 |
120 | 156 | fi |
121 | | - echo "✅ git tag $tag found on remote" |
122 | 157 | done |
0 commit comments