Dagger
Search

denoDeploy

This module provides functionality to deploy projects to Deno Deploy using the deployctl tool.
It includes a function to run the deployment process with specified parameters such as source directory,
authentication token, project name, organization, entry point file, and deployment mode (production or preview).

## Prerequisites

### CI/CD

To use the `DenoDeploy` module in your CI/CD pipeline, you need to store the `DENO_DEPLOY_TOKEN` as a secret in your CI/CD environment.
This token is used for authentication with the Deno Deploy service.

1. **Store the Token**: Add the `DENO_DEPLOY_TOKEN` as a secret in your CI/CD environment (e.g., GitHub Actions, GitLab CI, etc.).
2. **Pass the Token**: Pass the token in the `token` field when calling the `runDeployctl` function.

Example for GitHub Actions:

```yaml
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Deploy to Deno
env:
DENO_DEPLOY_TOKEN: ${{ secrets.DENO_DEPLOY_TOKEN }}
```

### Local Development

For local development, you need to set the `DENO_DEPLOY_TOKEN` in your terminal and pass it as an environment variable when running the deployment command.

1. **Set the Token**: Set the `DENO_DEPLOY_TOKEN` in your terminal.

```sh
export DENO_DEPLOY_TOKEN=your_token_here
```

2. **Pass the Token**: Pass the token as an environment variable when running the deployment command.

```sh
dagger call --token=env:DENO_DEPLOY_TOKEN
```

Installation

dagger install github.com/StaytunedLLP/daggerverse/denodeploy@v0.1.3

Entrypoint

Return Type
DenoDeploy
Example
dagger -m github.com/StaytunedLLP/daggerverse/denodeploy@400fda7c4a6f03bb7110170ffb50ca4bb0349a28 call \
func (m *myModule) example() *DenoDeploy  {
	return dag.
			DenoDeploy()
}
@function
def example() -> dag.DenoDeploy:
	return (
		dag.deno_deploy()
	)
@func()
example(): DenoDeploy {
	return dag
		.denoDeploy()
}

Types

DenoDeploy 🔗

runDeployctl() 🔗

Deploys a project using the deployctl tool in a Deno container.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
sourceDirectory !-- The source directory containing the project files to be deployed.
tokenSecret !-- The secret token used for authentication with the deployment service.
projectString !-- The name of the project to be deployed.
orgString !-- The organization under which the project is to be deployed (optional).
entrypointString !-- The entry point file for the deployment.
prodBoolean !-- A flag indicating whether to deploy in production mode (true) or preview mode (false).
Example
dagger -m github.com/StaytunedLLP/daggerverse/denodeploy@400fda7c4a6f03bb7110170ffb50ca4bb0349a28 call \
 run-deployctl --source DIR_PATH --token env:MYSECRET --project string --org string --entrypoint string --prod boolean
func (m *myModule) example(ctx context.Context, source *Directory, token *Secret, project string, org string, entrypoint string, prod bool) string  {
	return dag.
			DenoDeploy().
			RunDeployctl(ctx, source, token, project, org, entrypoint, prod)
}
@function
async def example(source: dagger.Directory, token: dagger.Secret, project: str, org: str, entrypoint: str, prod: bool) -> str:
	return await (
		dag.deno_deploy()
		.run_deployctl(source, token, project, org, entrypoint, prod)
	)
@func()
async example(source: Directory, token: Secret, project: string, org: string, entrypoint: string, prod: boolean): Promise<string> {
	return dag
		.denoDeploy()
		.runDeployctl(source, token, project, org, entrypoint, prod)
}