Skip to content

Try to create a base new IPython website from scratch #1

Try to create a base new IPython website from scratch

Try to create a base new IPython website from scratch #1

Workflow file for this run

name: Deploy to GitHub Pages
on:
# Trigger the workflow every time you push to the `main` branch
push:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab on GitHub.
workflow_dispatch:
# Allow this job to clone the repo and create a page deployment
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout your repository using git
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Determine base path
id: base_path
run: |
# If BASE_PATH secret is set, use it
# Otherwise, if repo name matches owner (username.github.io), use root
# Otherwise, use /repo-name
if [ -n "${{ secrets.BASE_PATH }}" ]; then
echo "base_path=${{ secrets.BASE_PATH }}" >> $GITHUB_OUTPUT
elif [ "${{ github.repository }}" == "${{ github.repository_owner }}/${{ github.repository_owner }}.github.io" ]; then
echo "base_path=" >> $GITHUB_OUTPUT
else
echo "base_path=/${{ github.event.repository.name }}" >> $GITHUB_OUTPUT
fi
- name: Build Astro site
run: npm run build
env:
BASE_PATH: ${{ steps.base_path.outputs.base_path }}
GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }}
# If you have other environment variables, set them here
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./dist
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4