Skip to content

Commit 6570562

Browse files
committed
Try to create a base new IPython website from scratch
1 parent 93296de commit 6570562

File tree

96 files changed

+8580
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+8580
-0
lines changed

.env.example

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# GitHub Personal Access Token (optional)
2+
# Get one at: https://github.com/settings/tokens
3+
# Increases API rate limit from 60/hour to 5000/hour
4+
# Usage: Create a .env file and add: GITHUB_TOKEN=your_token_here
5+
GITHUB_TOKEN=
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Install Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: '20'
24+
cache: 'npm'
25+
26+
- name: Install dependencies
27+
run: npm ci
28+
29+
- name: Build Astro site
30+
run: npm run build
31+
env:
32+
BASE_PATH: ""
33+
GITHUB_REPOSITORY_OWNER: ipython
34+
35+
- name: Upload artifact
36+
uses: actions/upload-pages-artifact@v3
37+
with:
38+
path: ./dist
39+
40+
deploy:
41+
needs: build
42+
runs-on: ubuntu-latest
43+
environment:
44+
name: github-pages
45+
url: ${{ steps.deployment.outputs.page_url }}
46+
steps:
47+
- name: Deploy to GitHub Pages
48+
id: deployment
49+
uses: actions/deploy-pages@v4

.github/workflows/deploy.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
# Trigger the workflow every time you push to the `main` branch
5+
push:
6+
branches: [ main ]
7+
# Allows you to run this workflow manually from the Actions tab on GitHub.
8+
workflow_dispatch:
9+
10+
# Allow this job to clone the repo and create a page deployment
11+
permissions:
12+
contents: read
13+
pages: write
14+
id-token: write
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout your repository using git
21+
uses: actions/checkout@v4
22+
23+
- name: Install Node.js
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: '20'
27+
cache: 'npm'
28+
29+
- name: Install dependencies
30+
run: npm ci
31+
32+
- name: Determine base path
33+
id: base_path
34+
run: |
35+
# If BASE_PATH secret is set, use it
36+
# Otherwise, if repo name matches owner (username.github.io), use root
37+
# Otherwise, use /repo-name
38+
if [ -n "${{ secrets.BASE_PATH }}" ]; then
39+
echo "base_path=${{ secrets.BASE_PATH }}" >> $GITHUB_OUTPUT
40+
elif [ "${{ github.repository }}" == "${{ github.repository_owner }}/${{ github.repository_owner }}.github.io" ]; then
41+
echo "base_path=" >> $GITHUB_OUTPUT
42+
else
43+
echo "base_path=/${{ github.event.repository.name }}" >> $GITHUB_OUTPUT
44+
fi
45+
46+
- name: Build Astro site
47+
run: npm run build
48+
env:
49+
BASE_PATH: ${{ steps.base_path.outputs.base_path }}
50+
GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }}
51+
# If you have other environment variables, set them here
52+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
54+
- name: Upload artifact
55+
uses: actions/upload-pages-artifact@v3
56+
with:
57+
path: ./dist
58+
59+
deploy:
60+
needs: build
61+
runs-on: ubuntu-latest
62+
environment:
63+
name: github-pages
64+
url: ${{ steps.deployment.outputs.page_url }}
65+
steps:
66+
- name: Deploy to GitHub Pages
67+
id: deployment
68+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dist
2+
node_modules
3+
.env

CNAME

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ipython.org

DEPLOYMENT.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# GitHub Pages Deployment
2+
3+
This repository is configured to automatically deploy to GitHub Pages at `https://ipython.github.io` (or `https://ipython.github.com` which still works).
4+
5+
## Setup Instructions
6+
7+
### 1. Enable GitHub Pages
8+
9+
1. Go to your repository Settings → Pages
10+
- Or visit: `https://github.com/ipython/[this-repo]/settings/pages`
11+
2. Under "Source", select **"GitHub Actions"** (not "Deploy from a branch")
12+
3. Save the settings
13+
14+
### 2. Deploy
15+
16+
The workflow will automatically run on every push to the `main` branch. You can also manually trigger it:
17+
18+
1. Go to Actions tab
19+
2. Select "Deploy to GitHub Pages" workflow
20+
3. Click "Run workflow" → "Run workflow"
21+
22+
## How It Works
23+
24+
The deployment workflow:
25+
26+
1. **Builds the site** from the `main` branch
27+
2. **Uploads** the built files as an artifact
28+
3. **Deploys** to GitHub Pages (which serves from the `gh-pages` branch automatically)
29+
4. Makes the site available at `https://ipython.github.io/[repo-name]` or `https://ipython.github.com/[repo-name]`
30+
31+
## Configuration
32+
33+
The build uses these environment variables:
34+
- `BASE_PATH`: Set to empty string for root domain deployment
35+
- `GITHUB_REPOSITORY_OWNER`: Set to `ipython` for correct asset paths
36+
37+
These are set automatically in the workflow.
38+
39+
## Troubleshooting
40+
41+
### "Permission denied" errors
42+
43+
- Ensure GitHub Pages is enabled in repository settings
44+
- Check that the workflow has the correct permissions (should be automatic)
45+
46+
### Build succeeds but site doesn't update
47+
48+
- Check the Actions logs for the deploy step
49+
- Wait a few minutes for GitHub Pages to rebuild
50+
- Verify the Pages source is set to "GitHub Actions" not a branch
51+
52+
### Site not accessible
53+
54+
- Check repository visibility (public repos work automatically)
55+
- Verify the repository name matches the expected GitHub Pages URL pattern
56+
- For organization repos, ensure Pages is enabled at the organization level if needed

0 commit comments

Comments
 (0)