Easily deploy a site to Distributed Press using GitHub Actions. Contains examples for deploying websites using Helia and Hypercore protocols.
Two GitHub Actions templates are provided:
-
static-deploy.yml: For static websites.
- Customize:
publish_dir: Set to your static site's output folder.site_url: Replaceexample.comwith your domain.
- Customize:
name: Publish Static Website to Distributed Press
on:
push:
branches: [main]
workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Publish to Distributed Press
uses: hyphacoop/actions-distributed-press@v1.1.0
with:
publish_dir: ./ # Set to your static site's output directory (e.g., ./ or public)
dp_url: https://api.distributed.press
refresh_token: ${{ secrets.DISTRIBUTED_PRESS_TOKEN }}
site_url: example.com # Replace with your custom domain
deploy_http: false
deploy_hyper: true
deploy_ipfs: true- build-deploy.yml: For projects requiring a build step.
- Customize:
publish_dir: Set to your build output folder.site_url: Replaceexample.comwith your domain.publish_branch: Adjustgh-pagesto your preferred branch (e.g.,prod).
- Customize:
name: Build and Deploy Site to Distributed Press
on:
push:
branches: [main]
workflow_dispatch:
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
# Step 1: Check out the repository
- uses: actions/checkout@v3
# Step 2: Set up Node.js
- name: Set up Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18
# Step 3: Install dependencies and build the site
- name: Install dependencies
run: npm ci
- name: Build the site
run: npm run build # Ensure this command generates output in the public directory
# Step 4: Deploy to Distributed Press
- name: Publish to Distributed Press
uses: hyphacoop/actions-distributed-press@v1.1.0
with:
publish_dir: public # (optional) defaults to /public
dp_url: https://api.distributed.press
refresh_token: ${{ secrets.DISTRIBUTED_PRESS_TOKEN }}
site_url: example.com # Replace with your custom domain
deploy_http: true
deploy_hyper: true
deploy_ipfs: true
# Step 5: Deploy to GitHub Pages
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: public # Set to your build output directory (e.g., public or dist)
publish_branch: gh-pages # Change to your GitHub Pages branch if different (e.g., prod)- Obtain a free Distributed Press token from get-a-token page.
- Add it as
DISTRIBUTED_PRESS_TOKENin your repository's Settings > Secrets and variables > Actions > Secrets.
Configure your domain for Distributed Press:
| Type | Name | Value |
|---|---|---|
CNAME |
example.com |
api.distributed.press. |
NS |
_dnslink.example.com |
api.distributed.press. |
Note: Include the trailing dot (.) in api.distributed.press..
- To obtain an SSL certificate, contact the Distributed Press team. For HTTP publishing, the most convenient method is GitHub Pages. See GitHub Pages domain setup for details.
There are three ways you can deploy your site:
- Sutty CMS: A no-code platform with templates for easy publishing.
- GitHub Actions: Automate deployment via workflows (as provided above).
- Distributed Press CLI: A command-line tool for advanced site management.
With the Fediverse Social Inbox integration support, your site can receive comments, likes, and replies from the Fediverse.
Please see Distributed Press Documentation.
Your site is now published over IPFS and Hyper can be accessed via ipns://yourdomain.com or hyper://yourdomain.com. You’ll also see it on our explore page 👀.