Skip to content

Commit 17f02e7

Browse files
authored
Feature: Enable Full Blog Post Support & Migrate to Netlify for Enhanced Deployment (#2)
* add gitignore * add distill style blog * update readme * add workflow to test * test pr * remove a test * fixing the workflow * fixing the workflow * fixing the workflow * fixing the workflow * fix workflow * mistakenly overwritten * fixing the config * update about sidebar. * sync the sidebar manually for now * try to use a explict netlify toml * simplify the actions * typo * fixed the herf check for scrolly * cache busting * make sure we are using static-assets folder * just ignore problematic links * typo * Commit a few bug fixes. * Fix side bar navigation. * probably have one blog post working * add badge.
1 parent f8bb5e8 commit 17f02e7

Some content is hidden

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

56 files changed

+950
-316
lines changed
Lines changed: 12 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# This workflow builds your Jekyll site and deploys it to GitHub Pages.
2-
# It handles both the main site deployment (from 'main' branch)
3-
# and temporary Pull Request preview deployments.
2+
# It handles only the main site deployment (from 'main' branch)
3+
# and manual deployments via workflow_dispatch.
4+
# PR preview logic has been removed.
45

56
name: Jekyll Build and Deploy
67

@@ -10,30 +11,18 @@ on:
1011
push:
1112
branches:
1213
- main
13-
# Triggers the workflow on pull request events (for PR previews)
14-
pull_request:
15-
branches:
16-
- main # PRs targeting the main branch
1714
# Allows you to run this workflow manually from the Actions tab in GitHub.
1815
workflow_dispatch:
1916
inputs:
2017
target_ref:
21-
description: 'Branch name (e.g., feature/my-branch) or PR number (e.g., 123) to build/deploy. Leave empty to use the current branch.'
18+
description: 'Branch name (e.g., feature/my-branch) to build/deploy. Leave empty to use the current branch (main).'
2219
required: false
2320
type: string
24-
# Removed: default: ${{ github.ref_name }} - This caused the "github not found" error
25-
cleanup_only:
26-
description: 'Set to true to only perform cleanup, skipping build/deploy.'
27-
required: false
28-
type: boolean
29-
default: false
3021

3122
# Define jobs
3223
jobs:
3324
# Job to perform the build and deploy
3425
deploy_site:
35-
# Only run if cleanup_only is not true
36-
if: github.event_name != 'workflow_dispatch' || github.event.inputs.cleanup_only == false
3726
runs-on: ubuntu-latest
3827

3928
permissions:
@@ -50,21 +39,16 @@ jobs:
5039
id: determine_ref
5140
run: |
5241
# Logic to determine the correct ref to checkout based on event type and inputs
53-
# For pull_request event, checkout the head ref of the PR
5442
# For push event, checkout the main branch
5543
# For workflow_dispatch:
56-
# If target_ref is a PR number (e.g., "123"), checkout 'refs/pull/123/merge'
57-
# Else (if target_ref is a branch name or empty), checkout that ref
58-
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
59-
echo "CHECKOUT_REF=${{ github.event.pull_request.head.ref }}" >> $GITHUB_OUTPUT
60-
elif [[ "${{ github.event_name }}" == "push" ]]; then
44+
# If target_ref is empty, use the current branch (main)
45+
# Else, checkout the specified branch name
46+
if [[ "${{ github.event_name }}" == "push" ]]; then
6147
echo "CHECKOUT_REF=${{ github.ref }}" >> $GITHUB_OUTPUT
6248
elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
6349
INPUT_REF="${{ github.event.inputs.target_ref }}"
6450
if [[ -z "$INPUT_REF" ]]; then # If target_ref is empty, use the current branch
6551
echo "CHECKOUT_REF=${{ github.ref }}" >> $GITHUB_OUTPUT # Use github.ref for the actual branch ref
66-
elif [[ "$INPUT_REF" =~ ^[0-9]+$ ]]; then # Check if input is a number (PR number)
67-
echo "CHECKOUT_REF=refs/pull/${INPUT_REF}/merge" >> $GITHUB_OUTPUT
6852
else # Assume it's a branch name
6953
echo "CHECKOUT_REF=refs/heads/${INPUT_REF}" >> $GITHUB_OUTPUT
7054
fi
@@ -86,18 +70,16 @@ jobs:
8670
- name: Install Jekyll dependencies
8771
run: bundle install
8872

89-
- name: Build Jekyll site
90-
# When GitHub Pages is configured to use GitHub Actions,
91-
# 'actions/configure-pages' and 'actions/deploy-pages'
92-
# automatically handle the baseurl for PR previews.
93-
# For the main branch deployment, Jekyll will correctly assume root.
94-
run: bundle exec jekyll build --trace
95-
9673
- name: Setup Pages
9774
# This action configures the GitHub Pages environment for deployment.
9875
# It sets up necessary environment variables like GITHUB_PAGES_URL.
76+
id: pages_setup # Added an ID to access its outputs
9977
uses: actions/configure-pages@v3
10078

79+
- name: Build Jekyll site
80+
# CRITICAL FIX: Explicitly pass the baseurl to Jekyll build using the output from Setup Pages
81+
run: bundle exec jekyll build --trace --baseurl "${{ steps.pages_setup.outputs.base_url }}"
82+
10183
- name: Upload artifact
10284
# Uploads the '_site' directory (your built Jekyll site) as an artifact.
10385
# This artifact will then be used by the deploy-pages action.
@@ -110,36 +92,3 @@ jobs:
11092
# The 'id' allows us to reference its outputs, like the page_url.
11193
id: deployment
11294
uses: actions/deploy-pages@v4
113-
114-
# Job to perform cleanup for specific manual deployments (not automatically cleaned up by GitHub)
115-
cleanup_deployment:
116-
# Only run if cleanup_only is true and a target_ref is provided
117-
if: github.event_name == 'workflow_dispatch' && github.event.inputs.cleanup_only == true && github.event.inputs.target_ref
118-
runs-on: ubuntu-latest
119-
120-
permissions:
121-
deployments: write # Needed for deleting deployments via the API
122-
123-
steps:
124-
- name: Determine Cleanup Reference
125-
id: determine_cleanup_ref
126-
run: |
127-
CLEANUP_INPUT="${{ github.event.inputs.target_ref }}"
128-
if [[ "$CLEANUP_INPUT" =~ ^[0-9]+$ ]]; then
129-
# Input is a PR number, cleanup target is the merge ref
130-
CLEANUP_REF="refs/pull/${CLEANUP_INPUT}/merge"
131-
else
132-
# Input is a branch name, cleanup target is the head ref
133-
CLEANUP_REF="refs/heads/${CLEANUP_INPUT}"
134-
fi
135-
echo "CLEANUP_REF=$CLEANUP_REF" >> $GITHUB_OUTPUT
136-
echo "Determined cleanup reference: $CLEANUP_REF"
137-
138-
- name: Delete GitHub Pages Deployment
139-
# This action deletes a GitHub Pages deployment for a specific reference (branch/PR).
140-
# It's crucial for cleaning up manual deployments not tied to a PR lifecycle.
141-
uses: strumwolf/delete-deployment-environment@v2
142-
with:
143-
token: ${{ secrets.GITHUB_TOKEN }}
144-
environment: github-pages # The environment name for GitHub Pages
145-
ref: ${{ steps.determine_cleanup_ref.outputs.CLEANUP_REF }} # The branch/PR ref whose deployment you want to delete

.gitignore

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Jekyll
2+
#
3+
# These are generated files and folders that Jekyll creates during the build process.
4+
# They should not be committed to your repository.
5+
_site/
6+
.jekyll-cache/
7+
.sass-cache/
8+
.jekyll-metadata
9+
*.jekyll-ref
10+
.jekyll-assets-cache/ # Newer Jekyll versions might use this
11+
12+
# Bundler
13+
#
14+
# If you use 'bundle install --path vendor/bundle', this directory contains
15+
# your Ruby gems and should generally be ignored.
16+
vendor/bundle/
17+
18+
# Dependencies of the Gemfile.lock
19+
#
20+
# While `Gemfile.lock` is often committed to ensure consistent dependency
21+
# versions across environments, some prefer to ignore it for simple sites
22+
# or local development. For a Jekyll project that will be deployed (e.g., GitHub Pages),
23+
# it's generally recommended to *include* Gemfile.lock.
24+
# If you want to ignore it, uncomment the line below:
25+
# Gemfile.lock
26+
27+
# Operating System Files
28+
#
29+
# macOS specific files
30+
.DS_Store
31+
32+
# Windows specific files
33+
Thumbs.db
34+
ehthumbs.db
35+
desktop.ini
36+
37+
# Editor/IDE Specific Files
38+
#
39+
# These are configuration or temporary files generated by your code editor or IDE.
40+
.idea/ # IntelliJ IDEA / WebStorm
41+
.vscode/ # VS Code settings (can be useful to share some settings, but often user-specific)
42+
*.sublime-project
43+
*.sublime-workspace
44+
*.swp # Vim swap files
45+
*~ # Temporary files created by some editors (e.g., Emacs)
46+
47+
# Log Files
48+
*.log
49+
50+
# Other temporary files
51+
*.tmp

.idea/.gitignore

Lines changed: 0 additions & 8 deletions
This file was deleted.

.idea/modules.xml

Lines changed: 0 additions & 8 deletions
This file was deleted.

.idea/vcs.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

.idea/website.iml

Lines changed: 0 additions & 9 deletions
This file was deleted.

Gemfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
source "https://rubygems.org"
2+
gem "jekyll", "~> 4.4"
3+
gem "jekyll-remote-theme"
4+
gem "jekyll-feed"
5+
gem "jekyll-sitemap"
6+
gem "jekyll-seo-tag"
7+
gem "jekyll-archives" # Add this
8+
gem "jekyll-paginate-v2" # Add this
9+
gem "jemoji" # Add this
10+
# Add other al-folio plugins here if you uncommented them in _config.yml
11+

0 commit comments

Comments
 (0)