Skip to content

hyphacoop/actions-distributed-press

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

actions-distributed-press

Easily deploy a site to Distributed Press using GitHub Actions. Contains examples for deploying websites using Helia and Hypercore protocols.

Usage

GitHub Actions Workflows

Two GitHub Actions templates are provided:

  1. static-deploy.yml: For static websites.

    • Customize:
      • publish_dir: Set to your static site's output folder.
      • site_url: Replace example.com with your domain.
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
  1. build-deploy.yml: For projects requiring a build step.
    • Customize:
      • publish_dir: Set to your build output folder.
      • site_url: Replace example.com with your domain.
      • publish_branch: Adjust gh-pages to your preferred branch (e.g., prod).
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)

Distributed Press Token Setup

  1. Obtain a free Distributed Press token from get-a-token page.
  2. Add it as DISTRIBUTED_PRESS_TOKEN in your repository's Settings > Secrets and variables > Actions > Secrets.

Domain Setup

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.

Deployment Options

There are three ways you can deploy your site:

  1. Sutty CMS: A no-code platform with templates for easy publishing.
  2. GitHub Actions: Automate deployment via workflows (as provided above).
  3. 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.

Congratulations!

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 👀.

About

Easily deploy a site to Distributed Press using GitHub Actions

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •