mirror of
https://github.com/we-promise/sure.git
synced 2026-05-30 07:49:01 +00:00
fix(preview): delete stale container app before redeploy (#1820)
This commit is contained in:
22
.github/workflows/preview-deploy.yml
vendored
22
.github/workflows/preview-deploy.yml
vendored
@@ -82,6 +82,28 @@ jobs:
|
||||
sed -i "s/\${PR_NUMBER}/${{ github.event.pull_request.number }}/g" src/index.ts
|
||||
cat wrangler.toml
|
||||
|
||||
- name: Delete existing preview container app before redeploy
|
||||
env:
|
||||
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||
working-directory: workers/preview
|
||||
run: |
|
||||
CONTAINER_NAME="sure-preview-${{ github.event.pull_request.number }}-railscontainer"
|
||||
echo "Looking for stale preview container app: $CONTAINER_NAME"
|
||||
|
||||
CONTAINER_ID=$(npx wrangler containers list --json | jq -r --arg NAME "$CONTAINER_NAME" '
|
||||
map(select((.name // .application_name // .app_name // "") == $NAME))
|
||||
| first
|
||||
| (.id // .container_id // .application_id // empty)
|
||||
')
|
||||
|
||||
if [ -n "$CONTAINER_ID" ]; then
|
||||
echo "Deleting stale preview container app $CONTAINER_NAME ($CONTAINER_ID)"
|
||||
npx wrangler containers delete "$CONTAINER_ID"
|
||||
else
|
||||
echo "No stale preview container app found; continuing"
|
||||
fi
|
||||
|
||||
- name: Delete existing preview Worker before redeploy
|
||||
env:
|
||||
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||
|
||||
Reference in New Issue
Block a user