Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 1 addition & 25 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -264,33 +264,9 @@ jobs:
files: |
./Devsy.flatpak

deploy-update-metadata:
name: Deploy Update Metadata to Netlify
needs: [build-desktop]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v6

- uses: actions/download-artifact@v8
with:
pattern: update-metadata-*
merge-multiple: true
path: sites/dl-devsy-sh/public/desktop

- name: deploy metadata
working-directory: sites/dl-devsy-sh
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
run: |
npm install -g netlify-cli
netlify deploy --prod --no-build \
--dir=public \
--site="$NETLIFY_SITE_ID"

prerelease:
name: Publish Prerelease
needs: [build-desktop, build-flatpak, deploy-update-metadata]
needs: [build-desktop, build-flatpak]
permissions:
contents: write
if: github.event.release.prerelease
Expand Down
67 changes: 67 additions & 0 deletions .github/workflows/restore-netlify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Restore Netlify Site

on:
workflow_dispatch:
inputs:
deploy_id:
description: "Specific deploy ID to restore (leave empty to auto-detect last good deploy)"
required: false
type: string

jobs:
restore:
name: Restore Netlify Production Deploy
runs-on: ubuntu-latest
steps:
- name: Find and restore deploy
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
DEPLOY_ID_INPUT: ${{ inputs.deploy_id }}
run: |
if [ -n "$DEPLOY_ID_INPUT" ]; then
DEPLOY_ID="$DEPLOY_ID_INPUT"
echo "Restoring specific deploy: $DEPLOY_ID"
else
echo "Finding last non-CLI deploy (from Netlify build system)..."
DEPLOY_ID=$(curl -s -H "Authorization: Bearer $NETLIFY_AUTH_TOKEN" \
"https://api.netlify.com/api/v1/sites/$NETLIFY_SITE_ID/deploys?per_page=20" | \
jq -r '[.[] | select(.deploy_source != "cli" and .state == "ready")] | .[0].id')

if [ "$DEPLOY_ID" = "null" ] || [ -z "$DEPLOY_ID" ]; then
echo "ERROR: Could not find a non-CLI deploy to restore"
echo "Available deploys:"
curl -s -H "Authorization: Bearer $NETLIFY_AUTH_TOKEN" \
"https://api.netlify.com/api/v1/sites/$NETLIFY_SITE_ID/deploys?per_page=10" | \
jq '.[] | {id, created_at, deploy_source, state, title}'
exit 1
fi
echo "Found deploy to restore: $DEPLOY_ID"
fi

echo "Restoring deploy $DEPLOY_ID to production..."
RESPONSE=$(curl -s -w "\n%{http_code}" -X POST \
-H "Authorization: Bearer $NETLIFY_AUTH_TOKEN" \
"https://api.netlify.com/api/v1/sites/$NETLIFY_SITE_ID/deploys/$DEPLOY_ID/restore")

HTTP_CODE=$(echo "$RESPONSE" | tail -1)
BODY=$(echo "$RESPONSE" | sed '$d')

if [ "$HTTP_CODE" != "200" ] && [ "$HTTP_CODE" != "201" ]; then
echo "ERROR: Netlify restore failed (HTTP $HTTP_CODE)"
echo "$BODY"
exit 1
fi
echo "Restore API returned HTTP $HTTP_CODE — success"

echo ""
echo "Verifying..."
sleep 10

STATUS=$(curl -s -o /dev/null -w "%{http_code}" "https://devsy.sh")
echo "devsy.sh HTTP status: $STATUS"
if [ "$STATUS" = "200" ]; then
echo "SUCCESS: devsy.sh is back online"
else
echo "WARNING: devsy.sh returned $STATUS — may need a few more seconds to propagate"
fi
Loading