DEV Community

Cover image for Deno Deploy Static Site
bronifty
bronifty

Posted on

Deno Deploy Static Site

youtube video tutorial

Use deployctl and Github Actions with a deploytcl task to deploy static sites to Deno Deploy

deploy static html site
deploy vite

Steps:

  • Create the static site content (either html etc or run the vite and then build, move into dist dir)
  • run the deployctl script using http file server
    • You'll need the access token to run the deployctl from your command line
    • when add the repo in settings with github action in a subsequent step and 'link' the repo to your account, you won't need the access token to deploy
export DENO_DEPLOY_TOKEN=abcdefg
cd dist
deployctl deploy --project=careful-goat-90 https://deno.land/std@0.171.0/http/file_server.ts
Enter fullscreen mode Exit fullscreen mode
  • Make sure you can get a deployment with that. Then we'll link the project to your github and use github action
deno run --allow-read --allow-write --allow-env npm:create-vite-extra@latest
Enter fullscreen mode Exit fullscreen mode

the github action

name: Deploy

on: push

jobs:
  deploy:
    runs-on: ubuntu-latest

    permissions:
      id-token: write # This is required to allow the GitHub Action to authenticate with Deno Deploy.
      contents: read

    steps:
      - name: Clone repository
        uses: actions/checkout@v3

      - name: Install Deno
        uses: denoland/setup-deno@v1

      - name: Build
        run: deno task build

      - name: Deploy to Deno Deploy
        uses: denoland/deployctl@v1
        with:
          project: late-duck-63 # the name of the project on Deno Deploy
          entrypoint: https://deno.land/std/http/file_server.ts
          root: dist
Enter fullscreen mode Exit fullscreen mode

Top comments (0)