diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2024-09-17 12:31:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-17 13:31:46 +0200 |
commit | 039e15fc84465fd2595d4fc74bf817a44ba371ec (patch) | |
tree | 09305762f744ecb0218d93b8765ca37e84c46236 /.github/workflows/ci.generate.ts | |
parent | aaf2bf4bfbf90bed0b6e9812f337f057d1d24f93 (diff) |
ci: make canary uploads less racy (#25671)
Closes https://github.com/denoland/deno/issues/25464
Only uploads canary git hash if the one in the bucket is present
in the current action Git history.
Diffstat (limited to '.github/workflows/ci.generate.ts')
-rwxr-xr-x | .github/workflows/ci.generate.ts | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/.github/workflows/ci.generate.ts b/.github/workflows/ci.generate.ts index 8cc57619b..608bb3048 100755 --- a/.github/workflows/ci.generate.ts +++ b/.github/workflows/ci.generate.ts @@ -813,8 +813,12 @@ const ci = { ].join("\n"), run: [ 'gsutil -h "Cache-Control: public, max-age=3600" cp ./target/release/*.zip gs://dl.deno.land/canary/$(git rev-parse HEAD)/', - "echo ${{ github.sha }} > canary-latest.txt", - 'gsutil -h "Cache-Control: no-cache" cp canary-latest.txt gs://dl.deno.land/canary-$(rustc -vV | sed -n "s|host: ||p")-latest.txt', + 'lastest_canary_hash=$(gsutil cat gs://dl.deno.land/canary-$(rustc -vV | sed -n "s|host: ||p")-latest.txt)', + "git cat-file -e $(lastest_canary_hash)", + "if [ $? -eq 0 ]; then", + " echo ${{ github.sha }} > canary-latest.txt", + ' gsutil -h "Cache-Control: no-cache" cp canary-latest.txt gs://dl.deno.land/canary-$(rustc -vV | sed -n "s|host: ||p")-latest.txt', + "fi", ].join("\n"), }, { @@ -1092,8 +1096,12 @@ const ci = { { name: "Upload canary version file to dl.deno.land", run: [ - "echo ${{ github.sha }} > canary-latest.txt", - 'gsutil -h "Cache-Control: no-cache" cp canary-latest.txt gs://dl.deno.land/canary-latest.txt', + "lastest_canary_hash=$(gsutil cat gs://dl.deno.land/canary-latest.txt) && \\", + "git cat-file -e $(lastest_canary_hash)", + "if [ $? -eq 0]; then", + " echo ${{ github.sha }} > canary-latest.txt && \\", + ' gsutil -h "Cache-Control: no-cache" cp canary-latest.txt gs://dl.deno.land/canary-latest.txt', + "fi", ].join("\n"), }, ], |