Skip to content
Closed
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
88 changes: 88 additions & 0 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Deploy to Production (main)

on:
push:
branches: [main]

permissions:
contents: read

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Cache Zola binary
id: cache-zola
uses: actions/cache@v4
with:
path: /usr/local/bin/zola
key: zola-binary-v0.22.1-${{ runner.os }}

- name: Install Zola (if not cached)
if: steps.cache-zola.outputs.cache-hit != 'true'
run: |
wget -q https://github.com/getzola/zola/releases/download/v0.22.1/zola-v0.22.1-x86_64-unknown-linux-gnu.tar.gz
tar xf zola-v0.22.1-x86_64-unknown-linux-gnu.tar.gz
chmod +x zola
sudo mv zola /usr/local/bin/zola

- name: Build Zola site
run: zola build

- name: Set up Node.js for ipfs-car
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Cache ipfs-car (global node_modules)
id: cache-ipfs-car
uses: actions/cache@v4
with:
path: ~/.npm/_npx
key: ipfs-car-npx-${{ runner.os }}-node20

- name: Install ipfs-car (if not cached)
if: steps.cache-ipfs-car.outputs.cache-hit != 'true'
run: npm install -g ipfs-car

- name: Create CAR archive of public folder
run: ipfs-car pack ./public --output prod.car

- name: Configure AWS credentials for Filebase
env:
AWS_ACCESS_KEY_ID: ${{ secrets.FILEBASE_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.FILEBASE_SECRET_KEY }}
AWS_DEFAULT_REGION: us-east-1 # Filebase ignores region, but required
run: |
echo "AWS credentials exported as env vars"
aws configure list

- name: Upload CAR to production bucket (with import=car)
id: upload
env:
AWS_EC2_METADATA_DISABLED: true
run: |
aws --endpoint-url https://s3.filebase.com \
s3 cp prod.car \
s3://${{ secrets.FILEBASE_BUCKET_PROD }}/site.car \
--content-type application/car \
--metadata import=car \
--debug > upload.log 2>&1

CID=$(grep -i 'x-amz-meta-cid' upload.log | awk -F': ' '{print $2}' | tr -d '\r')
if [ -z "$CID" ]; then
echo "Failed to extract CID from upload response"
cat upload.log
exit 1
fi
echo "cid=$CID" >> $GITHUB_OUTPUT

- name: Announce production deployment
run: |
echo "::notice title=Production Deployed::"
echo "Root CID: ${{ steps.upload.outputs.cid }}"
echo "View site: https://gateway.filebase.com/ipfs/${{ steps.upload.outputs.cid }}/"
# Optional: add IPNS update, GitHub deployment, Slack notification, etc. here
116 changes: 116 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: Preview on PR / Branch

on:
pull_request:
branches: [main]
push:
branches-ignore: [main]

permissions:
contents: read
pull-requests: write # needed to comment on PR

jobs:
build-and-preview:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Zola sometimes benefits from full history

- name: Cache Zola binary
id: cache-zola
uses: actions/cache@v4
with:
path: /usr/local/bin/zola
key: zola-binary-v0.22.1-${{ runner.os }}

- name: Install Zola (if not cached)
if: steps.cache-zola.outputs.cache-hit != 'true'
run: |
wget -q https://github.com/getzola/zola/releases/download/v0.22.1/zola-v0.22.1-x86_64-unknown-linux-gnu.tar.gz
tar xf zola-v0.22.1-x86_64-unknown-linux-gnu.tar.gz
chmod +x zola
sudo mv zola /usr/local/bin/zola

- name: Build Zola site
run: zola build

- name: Set up Node.js for ipfs-car
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Cache ipfs-car (global node_modules)
id: cache-ipfs-car
uses: actions/cache@v4
with:
path: ~/.npm/_npx
key: ipfs-car-npx-${{ runner.os }}-node20

- name: Install ipfs-car (if not cached)
if: steps.cache-ipfs-car.outputs.cache-hit != 'true'
run: npm install -g ipfs-car

- name: Create CAR archive of public folder
run: ipfs-car pack ./public --output preview.car

- name: Configure AWS credentials for Filebase
env:
AWS_ACCESS_KEY_ID: ${{ secrets.FILEBASE_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.FILEBASE_SECRET_KEY }}
AWS_DEFAULT_REGION: us-east-1 # Filebase ignores region, but required
run: |
echo "AWS credentials exported as env vars"
aws configure list

- name: Determine preview path prefix
id: vars
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
PREFIX="pr-${{ github.event.number }}/"
else
# For direct branch pushes (non-PR), use branch name sanitized
BRANCH_SAFE=$(echo "${GITHUB_REF_NAME}" | sed 's/[^a-zA-Z0-9-]/-/g')
PREFIX="branch-${BRANCH_SAFE}/"
fi
echo "prefix=$PREFIX" >> $GITHUB_OUTPUT
echo "short_sha=${GITHUB_SHA::8}" >> $GITHUB_OUTPUT

- name: Upload CAR to preview bucket (with import=car)
id: upload
env:
AWS_EC2_METADATA_DISABLED: true
run: |
aws --endpoint-url https://s3.filebase.com \
s3 cp preview.car \
s3://${{ secrets.FILEBASE_BUCKET_PREVIEW }}/${{ steps.vars.outputs.prefix }}site.car \
--content-type application/car \
--metadata import=car \
--debug > upload.log 2>&1

# Extract CID from debug log (x-amz-meta-cid header)
CID=$(grep -i 'x-amz-meta-cid' upload.log | awk -F': ' '{print $2}' | tr -d '\r')
if [ -z "$CID" ]; then
echo "Failed to extract CID from upload response"
cat upload.log
exit 1
fi
echo "cid=$CID" >> $GITHUB_OUTPUT

- name: Comment preview URL on PR
if: github.event_name == 'pull_request'
uses: thollander/actions-comment-pull-request@v3
with:
message: |
**Preview ready!**

View the preview build here:
https://gateway.filebase.com/ipfs/${{ steps.upload.outputs.cid }}/

(Root CID: ${{ steps.upload.outputs.cid }} – expires when PR is closed/branch deleted)

Alternative (S3 path): https://${{ secrets.FILEBASE_BUCKET_PREVIEW }}.s3.filebase.com/${{ steps.vars.outputs.prefix }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
comment_tag: preview-url # avoids duplicate comments on rebuilds
13 changes: 6 additions & 7 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ title = "libp2p - A modular network stack"
description = "Run your network applications free from runtime and address services, independently of their location."
author = "The libp2p Foundation"

[markdown]
# Whether to do syntax highlighting
# Theme can be customised by setting the `highlight_theme` variable to a theme supported by Zola
highlight_code = true
[markdown.highlighting]
light_theme = "github-light"
dark_theme = "github-dark"

[extra]
# Put all your custom variables here
Expand All @@ -26,9 +25,9 @@ github = "https://github.com/libp2p/libp2p"
implementations = "https://github.com/libp2p/libp2p?tab=readme-ov-file#implementations"
site_repo = "https://github.com/libp2p/website"
specs_repo = "https://github.com/libp2p/specs"
docs_repo = "https://docs.libp2p.io"
blog_url = "https://blog.libp2p.io"
connectivity_url = "https://connectivity.libp2p.io"
docs_repo = "https://libp2p.io/docs"
blog_url = "https://libp2p.io/blog"
connectivity_url = "https://libp2p.io/connectivity"

# discussion forums
libp2p_community = "https://discuss.libp2p.io"
Expand Down
4 changes: 0 additions & 4 deletions content/ethdenver-2024.md

This file was deleted.

36 changes: 0 additions & 36 deletions content/ethdenver-schedule-2024.json

This file was deleted.

5 changes: 0 additions & 5 deletions funding.json

This file was deleted.

File renamed without changes.
3 changes: 0 additions & 3 deletions public/404.html

This file was deleted.

Loading
Loading