mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 07:14:47 -05:00
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.
This commit is contained in:
parent
aaf2bf4bfb
commit
039e15fc84
2 changed files with 24 additions and 8 deletions
10
.github/workflows/ci.generate.ts
vendored
10
.github/workflows/ci.generate.ts
vendored
|
@ -813,8 +813,12 @@ const ci = {
|
||||||
].join("\n"),
|
].join("\n"),
|
||||||
run: [
|
run: [
|
||||||
'gsutil -h "Cache-Control: public, max-age=3600" cp ./target/release/*.zip gs://dl.deno.land/canary/$(git rev-parse HEAD)/',
|
'gsutil -h "Cache-Control: public, max-age=3600" cp ./target/release/*.zip gs://dl.deno.land/canary/$(git rev-parse HEAD)/',
|
||||||
|
'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",
|
" 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',
|
' 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"),
|
].join("\n"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -1092,8 +1096,12 @@ const ci = {
|
||||||
{
|
{
|
||||||
name: "Upload canary version file to dl.deno.land",
|
name: "Upload canary version file to dl.deno.land",
|
||||||
run: [
|
run: [
|
||||||
"echo ${{ github.sha }} > 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',
|
' gsutil -h "Cache-Control: no-cache" cp canary-latest.txt gs://dl.deno.land/canary-latest.txt',
|
||||||
|
"fi",
|
||||||
].join("\n"),
|
].join("\n"),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
10
.github/workflows/ci.yml
vendored
10
.github/workflows/ci.yml
vendored
|
@ -486,8 +486,12 @@ jobs:
|
||||||
github.ref == 'refs/heads/main')
|
github.ref == 'refs/heads/main')
|
||||||
run: |-
|
run: |-
|
||||||
gsutil -h "Cache-Control: public, max-age=3600" cp ./target/release/*.zip gs://dl.deno.land/canary/$(git rev-parse HEAD)/
|
gsutil -h "Cache-Control: public, max-age=3600" cp ./target/release/*.zip gs://dl.deno.land/canary/$(git rev-parse HEAD)/
|
||||||
|
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
|
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
|
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
|
||||||
- name: Autobahn testsuite
|
- name: Autobahn testsuite
|
||||||
if: |-
|
if: |-
|
||||||
!(matrix.skip) && ((matrix.os == 'linux' && matrix.arch != 'aarch64') &&
|
!(matrix.skip) && ((matrix.os == 'linux' && matrix.arch != 'aarch64') &&
|
||||||
|
@ -690,5 +694,9 @@ jobs:
|
||||||
project_id: denoland
|
project_id: denoland
|
||||||
- name: Upload canary version file to dl.deno.land
|
- name: Upload canary version file to dl.deno.land
|
||||||
run: |-
|
run: |-
|
||||||
echo ${{ github.sha }} > 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
|
gsutil -h "Cache-Control: no-cache" cp canary-latest.txt gs://dl.deno.land/canary-latest.txt
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in a new issue