Skip to content
Merged
50 changes: 46 additions & 4 deletions .github/workflows/netlify-ops.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
options:
- restore-devsy-sh
- find-dl-site
- add-dl-custom-domain

jobs:
restore-devsy-sh:
Expand All @@ -26,12 +27,12 @@ jobs:
DEPLOYS=$(curl -s -H "Authorization: Bearer $NETLIFY_AUTH_TOKEN" \
"https://api.netlify.com/api/v1/sites/$NETLIFY_SITE_ID/deploys?per_page=100")

DEPLOY_ID=$(echo "$DEPLOYS" | jq -r '[.[] | select(.state == "ready")] | .[0].id')
DEPLOY_INFO=$(echo "$DEPLOYS" | jq -r '[.[] | select(.state == "ready")] | .[0] | {id, created_at, deploy_source, title}')
DEPLOY_ID=$(echo "$DEPLOYS" | jq -r '[.[] | select(.state == "ready" and .deploy_source != "cli")] | .[0].id')
DEPLOY_INFO=$(echo "$DEPLOYS" | jq -r '[.[] | select(.state == "ready" and .deploy_source != "cli")] | .[0] | {id, created_at, deploy_source, title}')

if [ "$DEPLOY_ID" = "null" ] || [ -z "$DEPLOY_ID" ]; then
echo "ERROR: No ready deploy found in last 100. States seen:"
echo "$DEPLOYS" | jq '[.[] | .state] | group_by(.) | map({state: .[0], count: length})'
echo "ERROR: No non-CLI ready deploy found in last 100. All deploys:"
echo "$DEPLOYS" | jq '.[] | {id, state, deploy_source, created_at}' | head -80
exit 1
fi

Expand Down Expand Up @@ -94,3 +95,44 @@ jobs:
echo "NETLIFY_DL_SITE_ID = $DL_SITE_ID"
echo "========================================"
echo "Run: gh secret set NETLIFY_DL_SITE_ID --org devsy-org --visibility all --body \"$DL_SITE_ID\""

add-dl-custom-domain:
name: Add dl.devsy.sh Custom Domain to dl-devsy-sh Site
if: inputs.operation == 'add-dl-custom-domain'
runs-on: ubuntu-latest
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
DL_SITE_ID: a6c8ca4e-62c1-4c75-95ba-1abcd2af540f
steps:
- name: Add custom domain and report DNS instructions
run: |
echo "Adding dl.devsy.sh as custom domain to site $DL_SITE_ID..."
RESPONSE=$(curl -s -w "\n%{http_code}" -X PUT \
-H "Authorization: Bearer $NETLIFY_AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{"custom_domain": "dl.devsy.sh"}' \
"https://api.netlify.com/api/v1/sites/$DL_SITE_ID")

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

if [ "$HTTP_CODE" != "200" ] && [ "$HTTP_CODE" != "201" ]; then
echo "ERROR: Custom domain update failed (HTTP $HTTP_CODE)"
echo "$BODY"
exit 1
fi

echo "Custom domain set (HTTP $HTTP_CODE)"
NETLIFY_SUBDOMAIN=$(echo "$BODY" | jq -r '.subdomain // .name')
echo ""
echo "========================================"
echo "CUSTOM DOMAIN CONFIGURED: dl.devsy.sh"
echo "========================================"
echo ""
echo "CEO DNS action required — add this DNS record:"
echo " Type: CNAME"
echo " Name: dl"
echo " Value: ${NETLIFY_SUBDOMAIN}.netlify.app"
echo ""
echo "Full site info:"
echo "$BODY" | jq '{id, name, custom_domain, subdomain, url, ssl_url}'
29 changes: 18 additions & 11 deletions .github/workflows/promote-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ jobs:
private-key: ${{ secrets.DEVSY_GITHUB_APP_PRIVATE_KEY }}

- uses: actions/checkout@v6
with:
fetch-tags: true

- name: validate RC tag
env:
Expand Down Expand Up @@ -62,25 +64,30 @@ jobs:

echo "Stable tag: $STABLE_TAG at commit: $COMMIT_SHA"

- name: create stable release
- name: fetch RC release notes
id: rc_notes
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
STABLE_TAG: ${{ steps.version.outputs.stable_tag }}
COMMIT_SHA: ${{ steps.version.outputs.commit_sha }}
RC_TAG: ${{ inputs.rc_tag }}
run: |
gh release create "$STABLE_TAG" \
--target "$COMMIT_SHA" \
--title "$STABLE_TAG" \
--generate-notes \
--notes-start-tag "$RC_TAG" \
--draft
BODY=$(gh release view "$RC_TAG" --json body -q .body)
{ echo "body<<EOF"; echo "$BODY"; echo "EOF"; } >> "$GITHUB_OUTPUT"

echo "Created draft stable release $STABLE_TAG"
- name: create stable release
uses: softprops/action-gh-release@v3
with:
token: ${{ steps.app-token.outputs.token }}
tag_name: ${{ steps.version.outputs.stable_tag }}
target_commitish: ${{ steps.version.outputs.commit_sha }}
name: ${{ steps.version.outputs.stable_tag }}
body: ${{ steps.rc_notes.outputs.body }}
draft: false
prerelease: false
make_latest: true

- name: trigger full rebuild
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
GH_TOKEN: ${{ github.token }}
STABLE_TAG: ${{ steps.version.outputs.stable_tag }}
run: |
gh workflow run release.yml \
Expand Down
Loading