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
94 changes: 94 additions & 0 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
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 libp2p.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 set aws_access_key_id $AWS_ACCESS_KEY_ID
aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
aws configure set default.region $AWS_DEFAULT_REGION
aws configure list

- name: Upload CAR to production bucket (with import=car)
id: upload
env:
AWS_EC2_METADATA_DISABLED: true
run: |
aws --endpoint https://s3.filebase.com \
s3 cp libp2p.car \
s3://${{ secrets.FILEBASE_BUCKET_PROD }}/ \
--metadata 'import=car'
aws --endpoint https://s3.filebase.com \
s3api head-object \
--bucket ${{ secrets.FILEBASE_BUCKET_PROD }} \
--key libp2p.car > head-object.log 2>&1

# Extract CID from debug log (x-amz-meta-cid header)
CID=$(jq -r .Metadata.cid head-object.log | tr -d '\r')
if [ -z "$CID" ]; then
echo "Failed to extract CID from upload response"
cat head-object.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://libp2p.myfilebase.com/ipfs/${{ steps.upload.outputs.cid }}/"
# Optional: add IPNS update, GitHub deployment, Slack notification, etc. here
110 changes: 110 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: Preview on PR

on:
pull_request:
branches: [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 set aws_access_key_id $AWS_ACCESS_KEY_ID
aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
aws configure set default.region $AWS_DEFAULT_REGION
aws configure list

- name: Determine preview path prefix
id: vars
run: |
echo "prefix=pr-${{ github.event.number }}" >> $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 https://s3.filebase.com \
s3 cp preview.car \
s3://${{ secrets.FILEBASE_BUCKET_PROD }}/preview/${{ steps.var.outputs.prefix}}/ \
--metadata 'import=car'
aws --endpoint https://s3.filebase.com \
s3api head-object \
--bucket ${{ secrets.FILEBASE_BUCKET_PROD }} \
--key preview/${{ steps.var.output.prefix}}/preview.car > head-object.log 2>&1

# Extract CID from debug log (x-amz-meta-cid header)
CID=$(jq -r .Metadata.cid head-object.log | tr -d '\r')
if [ -z "$CID" ]; then
echo "Failed to extract CID from upload response"
cat head-object.log
exit 1
fi
echo "cid=$CID" >> $GITHUB_OUTPUT

- name: Comment preview URL on PR
uses: thollander/actions-comment-pull-request@v3
with:
message: |
**Preview ready!**

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

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

GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
comment_tag: preview-url # avoids duplicate comments on rebuilds
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.car
*.log
public/*
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