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
23 changes: 0 additions & 23 deletions .github/workflows/check.yml

This file was deleted.

33 changes: 0 additions & 33 deletions .github/workflows/deploy.yml

This file was deleted.

75 changes: 75 additions & 0 deletions .github/workflows/website.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: website

on:
pull_request:
push:
branches: [main]
workflow_dispatch:

permissions:
contents: read

jobs:
check:
name: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: "24"
cache: npm
- run: npm ci
- run: npm run verify
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
with:
name: website-build
path: dist/
include-hidden-files: true
retention-days: 1
if-no-files-found: error

deploy:
name: deploy
needs: check
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
runs-on: ubuntu-latest
environment:
name: production
url: https://omarchyqol.com
concurrency:
group: website-production
cancel-in-progress: false
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: "24"
cache: npm
- run: npm ci
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: website-build
path: dist/
- name: Check whether this commit is still current
id: revision
run: |
current=$(git ls-remote origin refs/heads/main | cut -f1)
if [ "$current" = "$GITHUB_SHA" ]; then
echo "deploy=true" >> "$GITHUB_OUTPUT"
else
echo "Skipping deployment because main has moved on"
fi
- name: Deploy website
if: steps.revision.outputs.deploy == 'true'
run: npx wrangler deploy --config dist/server/wrangler.json
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ vars.CLOUDFLARE_ACCOUNT_ID }}
- name: Deploy redirects
if: steps.revision.outputs.deploy == 'true'
run: npx wrangler deploy --config wrangler.redirects.jsonc
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ vars.CLOUDFLARE_ACCOUNT_ID }}
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,19 @@ npm run verify
Runs formatting, Astro diagnostics, the Cloudflare build, SEO checks, and
redirect tests. Build output is written to `dist/`.

GitHub Actions runs these checks on pull requests. A successful push to `main`
deploys the checked build to Cloudflare, then updates the redirect Worker. The
workflow can also be run manually from `main`.

Set the `CLOUDFLARE_API_TOKEN` Actions secret and `CLOUDFLARE_ACCOUNT_ID`
Actions variable before the first deployment. The token needs Worker script and
KV write access for the account, plus zone read and Worker route write access
for the two website zones.

For a manual deployment from a verified local build:

```bash
npx wrangler deploy --domain omarchyqol.com
npx wrangler deploy --config dist/server/wrangler.json
npx wrangler deploy --config wrangler.redirects.jsonc
```

Expand Down
1 change: 0 additions & 1 deletion astro.cloudflare.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ export default defineConfig({
...baseConfig,
output: "server",
adapter: cloudflare({
configPath: process.env.SST_WRANGLER_PATH,
imageService: "passthrough",
}),
})
Loading
Loading