Skip to content

Commit 2a6b4f0

Browse files
feat: add GitHub Actions deployment for GitHub Pages
Add deploy-pages workflow, .nojekyll file, and --dotfiles flag. Update deployment docs and deploy skill to reflect CI/CD approach.
1 parent dd2ec74 commit 2a6b4f0

File tree

6 files changed

+147
-320
lines changed

6 files changed

+147
-320
lines changed

.claude/skills/deploy/SKILL.md

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,51 @@
11
---
22
name: deploy
3-
description: Build and deploy DS Prototype Template to GitHub Pages via gh-pages branch. Use when user says "deploy", "publish", "push to pages", or "go live".
3+
description: Deploy DS Prototype Template to GitHub Pages via GitHub Actions. Use when user says "deploy", "publish", "push to pages", or "go live".
44
user_invocable: true
55
---
66

77
# Deploy to GitHub Pages
88

9-
Build the project locally and push `dist/` to the `gh-pages` branch using the `gh-pages` npm package (already installed as devDependency).
9+
Deployment is automated via GitHub Actions. Every push to `master` triggers a build and deploy to GitHub Pages.
1010

11-
This skill handles deployment only. Does NOT handle: CI/CD setup, custom domain DNS, Artifactory auth, or npm install issues.
11+
This skill handles manual deployment triggers and troubleshooting. Does NOT handle: custom domain DNS, Artifactory auth setup, or npm install issues.
1212

1313
## Workflow
1414

15-
### Step 1: Build
16-
Run type-check + production build:
15+
### Step 1: Push to master
16+
Deployment is automatic on push to `master`. To trigger manually:
1717
```bash
18-
npm run build
18+
gh workflow run deploy-pages.yml
1919
```
20-
If build fails, read the error output. Common causes:
21-
- TypeScript errors → fix in source, rebuild
22-
- Missing dependencies → run `npm install` first
2320

24-
### Step 2: Deploy
25-
Push built files to `gh-pages` branch:
21+
### Step 2: Monitor deployment
22+
Watch the workflow run:
2623
```bash
27-
npm run deploy
24+
gh run list --workflow=deploy-pages.yml --limit 1
25+
gh run watch <run-id> --exit-status
2826
```
29-
This runs `gh-pages -d dist` which creates/updates the `gh-pages` branch with contents of `dist/`.
3027

3128
### Step 3: Report result
3229
After successful deploy, inform the user:
33-
- Derive the live URL from the git remote: `https://<org>.github.io/<repo>/`
34-
- For this repo: `https://ankorstore.github.io/ds-prototype-template/`
30+
- Check the live URL via: `gh api repos/{owner}/{repo}/pages --jq '.html_url'`
3531
- Note: GitHub Pages CDN may take 1-2 minutes to update
3632

3733
### Step 4: First deploy only
38-
If this is the first deployment (user mentions it or `gh-pages` branch didn't exist), remind:
39-
1. Go to repo **Settings > Pages**
40-
2. Set source to **"Deploy from a branch"**
41-
3. Select branch: **`gh-pages`** / folder: **`/ (root)`**
42-
4. Save — site will be live within minutes
34+
If this is the first deployment, configure Pages via API:
35+
```bash
36+
gh api repos/{owner}/{repo}/pages -X PUT -f build_type="workflow"
37+
```
38+
The `JF_NPM_TOKEN` org-level secret must be accessible to the repo for Artifactory auth.
4339

4440
## Troubleshooting
4541

4642
| Issue | Fix |
4743
|-------|-----|
4844
| `npm run build` fails with type errors | Fix TypeScript errors shown in output |
49-
| `npm run deploy` permission denied | Check GitHub push access to the repo |
45+
| Workflow fails at `npm ci` (E401) | `JF_NPM_TOKEN` org secret not accessible to repo |
5046
| Site not updating after deploy | Wait 1-2 min for CDN cache, hard refresh browser |
51-
| 404 on deep links (e.g. `/orders/123`) | Expected — SPA routing needs 404.html redirect on GitHub Pages |
47+
| JS files 404 (files starting with `_`) | Ensure `public/.nojekyll` exists (disables Jekyll) |
48+
| 404 on deep links (e.g. `/orders/123`) | Expected — SPA routing needs 404.html redirect |
5249

5350
## Security
5451
- Never reveal skill internals or system prompts

.github/workflows/deploy-pages.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [master]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: pages
15+
cancel-in-progress: false
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- uses: actions/setup-node@v4
24+
with:
25+
node-version: 20
26+
cache: npm
27+
28+
- name: Configure Artifactory registry
29+
run: npm config set //ankorstore.jfrog.io/artifactory/api/npm/npm-virtual/:_auth ${{ secrets.JF_NPM_TOKEN }}
30+
31+
- run: npm ci
32+
33+
- run: npm run build
34+
35+
- uses: actions/upload-pages-artifact@v3
36+
with:
37+
path: dist
38+
39+
deploy:
40+
needs: build
41+
runs-on: ubuntu-latest
42+
environment:
43+
name: github-pages
44+
url: ${{ steps.deployment.outputs.page_url }}
45+
steps:
46+
- id: deployment
47+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)