Deploying sites
GitHub Actions

Deploying with Github Actions


This reference assumes you already have access to a Distributed Press API instance. You can either self-host your own instance of Distributed Press, use Sutty, or contact a member of the Distributed Press team for access to our managed API server.

If you are used to deploying to GitHub pages or any other hosting provider that uses GitHub actions, actions-distributed-press allows you to just add a single step to your actions workflow to also deploy a bundle of static files to Distributed Press.

Distributed Press only supports deploying a folder of static files. Most frameworks like Next.js, React, and Hugo, allow you to 'export' or 'build' your site as bunch of static files.

Read the source here (opens in a new tab)

To your existing action workflow, add a step to publish to Distributed Press. Additionally, add an encrypted secret in your repository (opens in a new tab) containing a valid refresh token issued your specified Distributed Press API instance.

The name of the secret should be REFRESH_TOKEN and the value should be the JWT itself. If you are unsure where to get a JWT token, see the reference on authorization.

    runs-on: ubuntu-20.04
      - uses: actions/checkout@v2
        ... steps to build your site go here 
      - name: Publish to Distributed Press
        uses: hyphacoop/actions-distributed-press@v1.1
          publish_dir: public                           # (optional) defaults to /public
          dp_url: https://your-hosted.dp.instance       # URL of Distributed Press API Instance (include http/https)
          refresh_token: ${{ secrets.REFRESH_TOKEN }}   # Refresh token 
          site_url:              # Site domain (as created through the API) 
          deploy_http: false
          deploy_hyper: true
          deploy_ipfs: true

Example Next.js Deployment

In your repository, create a new file github/workflows/deploy-distributed-press.yaml

name: "Publish GitHub Action"
      - main
    runs-on: ubuntu-latest
    - uses: actions/checkout@v3
    - name: Use Node.js 18
      uses: actions/setup-node@v3
        node-version: 18
    - run: npm ci
    - run: npm run build
    - name: Publish to Distributed Press
      uses: hyphacoop/actions-distributed-press@v1.1
        publish_dir: public
        dp_url: https://your-hosted.dp.instance
        refresh_token: ${{ secrets.REFRESH_TOKEN }}

This will build and publish your site to the Distributed Press instance hosted at https://your-hosted.dp.instance