deploy/classic/ci_github.md
:::info Legacy Documentation
You are viewing legacy documentation for Deno Deploy Classic. We recommend migrating to the new <a href="/deploy/">Deno Deploy</a> platform.
:::
Deno Deploy's Git integration enables deployment of code changes that are pushed
to a GitHub repository. Commits on the production branch will be deployed as a production deployment. Commits on all other branches will be deployed as a preview deployment.
There are two modes of operation for the Git integration:
Deno Deploy will select an appropriate mode based on your custom deployment configuration. Below, we go into more detail about the different configurations for Automatic and GitHub Actions mode.
If your project doesn't require any additional build steps, then the system chooses Automatic mode. The entrypoint file is simply the file that Deno Deploy will run.
If you enter a command in Install Step and/or Build Step in the
Project Configuration, Deno Deploy Classic will create a necessary GitHub
Actions workflow file and push it into your repository. In this workflow file,
we leverage the deployctl Github action to deploy your
project. You can do whatever you need to do, such as running a build command,
before deploying it to Deno Deploy.
To configure preprocessing commands you want to run, click Show advanced options button that appears after choosing your git repository. Then enter values as needed to input boxes.
:::tip
For example, if you want to enable ahead-of-time builds for a Fresh project,
you will enter deno task build in the Build Step box.
See also the Fresh doc for deploying a Fresh project to Deno Deploy.
:::
The GitHub Actions workflow file that Deno Deploy Classic generates and pushes to your repository looks like as follows.
name: Deploy
on:
push:
branches: main
pull_request:
branches: main
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
permissions:
id-token: write # Needed for auth with Deno Deploy
contents: read # Needed to clone the repository
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Install Deno
uses: denoland/setup-deno@v2
with:
deno-version: v2.x
- name: Build step
run: "deno task build"
- name: Upload to Deno Deploy
uses: denoland/deployctl@v1
with:
project: "<your-project-name>"
entrypoint: "main.ts"
root: "."
See deployctl README for more details.