Skip to content

Commit ac0bfbc

Browse files
committed
update
1 parent 6968804 commit ac0bfbc

2 files changed

Lines changed: 83 additions & 5 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,18 @@ on:
66
pull_request:
77
branches: [ main ]
88

9+
# Add permissions for GITHUB_TOKEN
10+
permissions:
11+
contents: read
12+
pages: write
13+
id-token: write
14+
915
jobs:
1016
build-and-deploy:
1117
runs-on: ubuntu-latest
18+
environment:
19+
name: github-pages
20+
url: ${{ steps.deployment.outputs.page_url }}
1221

1322
steps:
1423
- name: Checkout repository
@@ -28,10 +37,17 @@ jobs:
2837
- name: Build documentation
2938
run: npm run docs:build
3039

31-
- name: Deploy to GitHub Pages
40+
- name: Setup Pages
41+
if: github.ref == 'refs/heads/main'
42+
uses: actions/configure-pages@v4
43+
44+
- name: Upload artifact
3245
if: github.ref == 'refs/heads/main'
33-
uses: peaceiris/actions-gh-pages@v3
46+
uses: actions/upload-pages-artifact@v3
3447
with:
35-
github_token: ${{ secrets.GITHUB_TOKEN }}
36-
publish_dir: docs/.vitepress/dist
37-
cname: # Add your custom domain here if you have one
48+
path: docs/.vitepress/dist
49+
50+
- name: Deploy to GitHub Pages
51+
if: github.ref == 'refs/heads/main'
52+
id: deployment
53+
uses: actions/deploy-pages@v4

GITHUB_PAGES_SETUP.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# GitHub Pages Setup Instructions
2+
3+
## 🚀 Quick Setup for GitHub Pages Deployment
4+
5+
After pushing the updated workflow, you need to configure GitHub Pages in your repository settings:
6+
7+
### Step 1: Enable GitHub Pages
8+
9+
1. Go to your repository on GitHub: `https://github.com/rushhiii/Scriptable-IOSWidgets`
10+
2. Click on **Settings** tab
11+
3. Scroll down to **Pages** section in the left sidebar
12+
4. Click on **Pages**
13+
14+
### Step 2: Configure Pages Source
15+
16+
1. Under **Source**, select **GitHub Actions** (not Deploy from a branch)
17+
2. This tells GitHub to use the workflow we created instead of looking for a gh-pages branch
18+
19+
### Step 3: Verify Deployment
20+
21+
1. Push your changes to the main branch
22+
2. Go to **Actions** tab in your repository
23+
3. Watch the "Deploy VitePress Documentation" workflow run
24+
4. Once complete, your site will be available at: `https://rushhiii.github.io/Scriptable-IOSWidgets/`
25+
26+
## 🔧 What Was Fixed
27+
28+
### Previous Issues:
29+
- ❌ Missing permissions for GITHUB_TOKEN
30+
- ❌ Using deprecated peaceiris/actions-gh-pages@v3
31+
- ❌ No proper environment configuration
32+
33+
### Solutions Applied:
34+
- ✅ Added proper permissions (`contents: read`, `pages: write`, `id-token: write`)
35+
- ✅ Updated to use official GitHub Pages actions
36+
- ✅ Added environment configuration for better security
37+
- ✅ Using modern `actions/deploy-pages@v4`
38+
39+
## 📝 Updated Workflow Features
40+
41+
- **Automatic Deployment**: Deploys on every push to main branch
42+
- **Security**: Uses GitHub's official Pages deployment actions
43+
- **Reliability**: Modern actions with better error handling
44+
- **URL Output**: Provides the deployed site URL after successful deployment
45+
46+
## 🌐 Expected Site URL
47+
48+
Your documentation will be available at:
49+
```
50+
https://rushhiii.github.io/Scriptable-IOSWidgets/
51+
```
52+
53+
## 🔍 Troubleshooting
54+
55+
If the deployment still fails:
56+
57+
1. **Check Repository Settings**: Ensure Pages source is set to "GitHub Actions"
58+
2. **Verify Workflow**: Check the Actions tab for detailed error logs
59+
3. **Repository Permissions**: Make sure your account has admin access to the repository
60+
4. **Branch Protection**: Ensure main branch allows Actions to run
61+
62+
The workflow should now deploy successfully! 🎉

0 commit comments

Comments
 (0)