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
122 changes: 108 additions & 14 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,34 @@
name: Deploy

on:
workflow_dispatch: # Allows manual trigger
push:
branches: [v1]
workflow_dispatch:
pull_request:
branches: [v1]
push:
branches:
- v1

permissions:
contents: read

jobs:
deploy:
name: Deploy
deploy-preview:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 15

environment:
name: Preview
url: ${{ steps.netlify.outputs.unique-url }}

permissions:
id-token: write # Needed for auth with Deno Deploy
contents: read # Needed to clone the repository
contents: read
pull-requests: write

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v7
with:
fetch-depth: 0

- name: Setup Deno
uses: denoland/setup-deno@v2
Expand All @@ -41,9 +50,94 @@ jobs:
- name: Staticalize
run: deno task staticalize

- name: Upload to Deno Deploy
uses: denoland/deployctl@v1
- name: Deploy Preview to Netlify
id: netlify
run: |
PR_NUMBER="${{ github.event.pull_request.number }}"
COMMIT_SHA="${{ github.event.pull_request.head.sha }}"

DEPLOY_OUTPUT=$(npx netlify-cli deploy \
--dir=built \
--alias="pr-$PR_NUMBER" \
--message="Preview for PR #$PR_NUMBER at commit $COMMIT_SHA" \
--auth=${{ secrets.NETLIFY_AUTH_TOKEN }} \
--site=${{ secrets.NETLIFY_SITE_ID }} \
--json)

DEPLOY_ID=$(echo "$DEPLOY_OUTPUT" | jq -r '.deploy_id')
SITE_NAME=$(echo "$DEPLOY_OUTPUT" | jq -r '.site_name')

UNIQUE_URL="https://${DEPLOY_ID}--${SITE_NAME}.netlify.app"
STABLE_URL="https://pr-${PR_NUMBER}--${SITE_NAME}.netlify.app"

echo "unique-url=$UNIQUE_URL" >> $GITHUB_OUTPUT
echo "stable-url=$STABLE_URL" >> $GITHUB_OUTPUT

- name: Comment PR with Preview Link
uses: marocchino/sticky-pull-request-comment@5770ad5eb8f42dd2c4f34da00c94c5381e49af88 # v3.0.5
with:
header: netlify-preview-deploy
message: |
🚀 **Deploy Preview Ready!**

* **Stable Review Link:** ${{ steps.netlify.outputs.stable-url }}
* **Latest Commit Snapshot:** ${{ steps.netlify.outputs.unique-url }}

deploy-production:
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
timeout-minutes: 15
environment:
name: Production
url: https://graphgen-data.netlify.app

steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 0

- name: Setup Deno
uses: denoland/setup-deno@v2
with:
project: graphgen
entrypoint: "jsr:@std/http/file-server"
root: built
deno-version: v2.x

- name: Start Fresh server
run: |
deno run -A main.ts &
until curl --output /dev/null --silent --head --fail http://127.0.0.1:8000; do
printf '.'
sleep 1
done
env:
PORT: 8000
timeout-minutes: 5
working-directory: ./www

- name: Staticalize
run: deno task staticalize

- name: Deploy to Production
run: |
npx netlify-cli deploy \
--dir=built \
--prod \
--auth=${{ secrets.NETLIFY_AUTH_TOKEN }} \
--site=${{ secrets.NETLIFY_SITE_ID }}

trigger-frontside-rebuild:
needs: deploy-production
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Wait for Netlify propagation
run: sleep 60

- name: Trigger frontside.com production rebuild
env:
GH_TOKEN: ${{ secrets.FRONTSIDEJACK_GITHUB_TOKEN }}
run: |
gh workflow run deploy.yaml \
--repo thefrontside/frontside.com \
--ref production
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"build:cli": "cd cli && deno task build:cli",
"dev": "cd www && deno run -A dev.ts",
"start": "cd www && deno run -A main.ts",
"staticalize": "deno run -A jsr:@frontside/staticalize@0.2.2/cli --site http://localhost:8000 --output=built --base=https://graphgen.deno.dev && deno run -A fix-static-css.ts"
"staticalize": "deno run -A jsr:@frontside/staticalize@0.2.6/cli --site http://localhost:8000 --output=built --base=https://graphgen-data.netlify.app && deno run -A fix-static-css.ts"
},
"lint": {
"rules": {
Expand Down
8 changes: 4 additions & 4 deletions www/deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading