Merge pull request 'CI: a rerun of a main run no longer fails on its own deploy tag' (#89) from deploy-tag-idempotent into main
CI / UI screenshots (before/after) (push) Skipped
CI / Test (jest) (push) Successful in 20s
CI / Lint (eslint) (push) Successful in 21s
CI / Security (npm audit) (push) Successful in 34s
CI / Scan (secrets, workflows, shell) (push) Successful in 1m12s
CI / Integration (api) (push) Successful in 2m25s
CI / UI (playwright) (push) Successful in 2m43s
CI / Deploy (push) Successful in 16s
CI / Deploy worker (push) Successful in 22s
CI / Notify (push) Successful in 3s
CI / UI screenshots (before/after) (push) Skipped
CI / Test (jest) (push) Successful in 20s
CI / Lint (eslint) (push) Successful in 21s
CI / Security (npm audit) (push) Successful in 34s
CI / Scan (secrets, workflows, shell) (push) Successful in 1m12s
CI / Integration (api) (push) Successful in 2m25s
CI / UI (playwright) (push) Successful in 2m43s
CI / Deploy (push) Successful in 16s
CI / Deploy worker (push) Successful in 22s
CI / Notify (push) Successful in 3s
This commit was merged in pull request #89.
This commit is contained in:
commit
fb5ef452d5
1 file changed
+11
-2
+11
-2
@@ -319,11 +319,20 @@ jobs:
|
||||
REPO: ${{ github.repository }}
|
||||
run: |
|
||||
TAG="deploy-$(date -u +%Y.%m.%d)-${RUN_NUMBER}"
|
||||
curl -sf -X POST \
|
||||
API="https://code.lotusguild.org/api/v1/repos/${REPO}/tags"
|
||||
code=$(curl -s -o /tmp/tag.json -w '%{http_code}' -X POST \
|
||||
-H "Authorization: token $GITHUB_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"tag_name\":\"${TAG}\",\"target\":\"${GIT_SHA}\",\"message\":\"Deployed to production\"}" \
|
||||
"https://code.lotusguild.org/api/v1/repos/${REPO}/tags"
|
||||
"$API")
|
||||
if [ "$code" = 201 ]; then echo "Tagged ${GIT_SHA} as ${TAG}"; exit 0; fi
|
||||
# A rerun keeps its run number, so the tag can already exist: fine if it is
|
||||
# this commit's, an error if it names another.
|
||||
existing=$(curl -sf -H "Authorization: token $GITHUB_TOKEN" "$API/${TAG}" \
|
||||
| node -e 'let d="";process.stdin.on("data",c=>d+=c).on("end",()=>{try{console.log(JSON.parse(d).commit.sha)}catch(e){}})')
|
||||
if [ "$existing" = "$GIT_SHA" ]; then echo "${TAG} already marks ${GIT_SHA} (a rerun)"; exit 0; fi
|
||||
echo "Could not tag ${GIT_SHA} as ${TAG} (HTTP ${code}; existing: ${existing:-none})"
|
||||
cat /tmp/tag.json; exit 1
|
||||
|
||||
deploy-worker:
|
||||
name: Deploy worker
|
||||
|
||||
Reference in new issue
Block a user