Deno 部署
¥Deno Deploy
将 Nitro 应用部署到 Deno 部署。
预设:deno_deploy
¥Preset: deno_deploy
使用 CLI 部署
¥Deploy with the CLI
你可以使用 deployctl 部署你的应用。
¥You can use deployctl to deploy your app.
登录 Deno 部署 获取 DENO_DEPLOY_TOKEN
访问令牌,并将其设置为环境变量。
¥Login to Deno Deploy to obtain a DENO_DEPLOY_TOKEN
access token, and set it as an environment variable.
# Build with the deno_deploy NITRO preset
NITRO_PRESET=deno_deploy npm run build
# Make sure to run the deployctl command from the output directory
cd .output
deployctl deploy --project=my-project server/index.ts
使用 gitHub Actions 在 CI/CD 中部署
¥Deploy within CI/CD using gitHub actions
你只需将 deployctl GitHub Action 作为工作流程中的一个步骤即可。
¥You just need to include the deployctl GitHub Action as a step in your workflow.
你无需设置任何 secret 即可使其正常工作。你需要将你的 GitHub 仓库链接到你的 Deno Deploy 项目,并选择 "GitHub Actions" 部署模式。你可以在 Deno 部署 的项目设置中执行此操作。
¥You do not need to set up any secrets for this to work. You do need to link your GitHub repository to your Deno Deploy project and choose the "GitHub Actions" deployment mode. You can do this in your project settings on Deno Deploy.
在 .github/workflows
目录中创建以下工作流文件:
¥Create the following workflow file in your .github/workflows
directory:
name: deno-deploy
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
deploy:
steps:
- uses: actions/checkout@v3
- run: corepack enable
- uses: actions/setup-node@v3
with:
node-version: 18
cache: pnpm
- run: pnpm install
- run: pnpm build
env:
NITRO_PRESET: deno_deploy
- name: Deploy to Deno Deploy
uses: denoland/deployctl@v1
with:
project: my-project
entrypoint: server/index.ts
root: .output
Deno 运行时
¥Deno runtime