Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Build Hugo Site

on:
pull_request:

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
env:
HUGO_VERSION: 0.155.1
steps:
- name: Install Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb

- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'

- name: Install Node dependencies
run: |
if [ -f package.json ]; then
npm install
fi

- name: Create data directory
run: mkdir -p data

- name: Update community stats
run: |
if [ -f .github/scripts/fetch-discourse-activity.js ]; then
echo "Running Discourse activity script..."
node .github/scripts/fetch-discourse-activity.js || true
fi

if [ ! -f data/community_stats.json ]; then
echo "Creating fallback community stats..."
cat > data/community_stats.json << 'EOF'
{
"activities": [
{
"message": "PowerShell community thriving",
"time": "Ongoing",
"type": "community",
"color": "bg-blue-500"
}
],
"stats": {
"total_topics": 15000,
"total_posts": 80000,
"active_users": 12000,
"topics_this_week": 40
},
"last_updated": "2024-01-01T00:00:00.000Z",
"fallback": true
}
EOF
fi

- name: Build with Hugo
env:
HUGO_ENVIRONMENT: production
HUGO_ENV: production
run: |
hugo \
--gc \
--minify \
--destination docs
44 changes: 17 additions & 27 deletions .github/workflows/hugo.yml → .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
name: Build and Deploy Hugo Site
name: Deploy Hugo Site

on:
push:
branches:
- main
pull_request:

permissions:
contents: write
pages: write
id-token: write

jobs:
build-and-deploy:
deploy:
runs-on: ubuntu-latest
env:
HUGO_VERSION: 0.155.1
Expand All @@ -21,27 +18,27 @@ jobs:
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb

- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'

- name: Install Node dependencies
run: |
if [ -f package.json ]; then
npm install
fi

- name: Create data directory
run: mkdir -p data

- name: Update community stats
run: |
if [ -f .github/scripts/fetch-discourse-activity.js ]; then
Expand Down Expand Up @@ -116,49 +113,42 @@ jobs:
}
EOF
fi

- name: Verify community stats file exists
run: |
if [ -f data/community_stats.json ]; then
echo "✅ Community stats file created successfully"
echo "File contents:"
echo "Community stats file created successfully"
cat data/community_stats.json
else
echo "Community stats file not found"
echo "Community stats file not found"
exit 1
fi

- name: Build with Hugo
env:
HUGO_ENVIRONMENT: production
HUGO_ENV: production
run: |
# Clean docs directory
rm -rf docs

# Build Hugo site to docs directory
hugo \
--gc \
--minify \
--destination docs \
--destination docs

- name: Add .nojekyll file
run: touch docs/.nojekyll

- name: Commit and push to main
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"

# Add files that exist

git add docs/ || echo "No docs directory to add"

# Only add data files if they exist

if [ -f data/community_stats.json ]; then
git add data/community_stats.json
fi

# Only commit if there are changes

if ! git diff --staged --quiet; then
git commit -m "Deploy Hugo site to docs/ [skip ci]"
git push
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ Here's a quick one for ya. Perfect kitchen timer. Who doesn't have a laptop with


start-sleep (60*9); write-host ("`a"*4)</pre>
<p>Start-Sleep works in seconds, so you see where I've done some quick<br />
math to get nine minutes. Not sure if the ()'s were required, but they<br />
don't hurt. I didn't know the precedence of parameter parsing versus<br />
multiplication off the top of my head. Next is Write-Host with some<br />
Start-Sleep works in seconds, so you see where I've done some quick
math to get nine minutes. Not sure if the ()'s were required, but they
don't hurt. I didn't know the precedence of parameter parsing versus
multiplication off the top of my head. Next is Write-Host with some
more multiplication. This one uses "`a" which is the special character

which emits a beep (old schoolers know this as the ASCII code for
Expand Down
2 changes: 1 addition & 1 deletion hugo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pagination:
markup:
goldmark:
renderer:
unsafe: true
unsafe: false
highlight:
style: github
lineNos: true
Expand Down
Loading