Dragee
Once the test, lint and build steps are done, the module is published to npm registryThere are 3 available entrypoints for CIs which are:
- `on_pull_request`: runs the lint and test steps on a pull request
- `on_publish`: runs the lint, test and build steps on a release and then publish it to npm registry
- `publish`: ⚠️ runs the lint, test and then publish to npm registry - it's a temporary entrypoint since some packages like the asserters cannot be build at the moment
Installation
dagger install github.com/fixentropy-io/daggerverse@a69d402f01017086828f9d8bdbe5dba968d81433Entrypoint
Return Type
Dragee Example
dagger -m github.com/fixentropy-io/daggerverse@a69d402f01017086828f9d8bdbe5dba968d81433 call \
func (m *MyModule) Example() *dagger.Dragee {
return dag.
Dragee()
}@function
def example() -> dagger.Dragee:
return (
dag.dragee()
)@func()
example(): Dragee {
return dag
.dragee()
}Types
Dragee 🔗
bunContainer() 🔗
Used to create a container with bun installed
Return Type
Container !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| bunVersion | String ! | "latest" | specify the version of bun to use |
Example
dagger -m github.com/fixentropy-io/daggerverse@a69d402f01017086828f9d8bdbe5dba968d81433 call \
bun-container --bun-version stringfunc (m *MyModule) Example(bunVersion string) *dagger.Container {
return dag.
Dragee().
BunContainer(bunVersion)
}@function
def example(bun_version: str) -> dagger.Container:
return (
dag.dragee()
.bun_container(bun_version)
)@func()
example(bunVersion: string): Container {
return dag
.dragee()
.bunContainer(bunVersion)
}nodeContainer() 🔗
Used to create a container with node installed
Return Type
Container !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| nodeVersion | String ! | "current-alpine3.21" | specify the version of node to use |
Example
dagger -m github.com/fixentropy-io/daggerverse@a69d402f01017086828f9d8bdbe5dba968d81433 call \
node-container --node-version stringfunc (m *MyModule) Example(nodeVersion string) *dagger.Container {
return dag.
Dragee().
NodeContainer(nodeVersion)
}@function
def example(node_version: str) -> dagger.Container:
return (
dag.dragee()
.node_container(node_version)
)@func()
example(nodeVersion: string): Container {
return dag
.dragee()
.nodeContainer(nodeVersion)
}installDependencies() 🔗
Used to install dependencies of the project on a bun container
Return Type
Container !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| source | Directory ! | - | the directory containing the project |
Example
dagger -m github.com/fixentropy-io/daggerverse@a69d402f01017086828f9d8bdbe5dba968d81433 call \
install-dependencies --source DIR_PATHfunc (m *MyModule) Example(source *dagger.Directory) *dagger.Container {
return dag.
Dragee().
InstallDependencies(source)
}@function
def example(source: dagger.Directory) -> dagger.Container:
return (
dag.dragee()
.install_dependencies(source)
)@func()
example(source: Directory): Container {
return dag
.dragee()
.installDependencies(source)
}mountAppWith() 🔗
This step is used to mount the project’s directory/files and dependencies on a fresh bun container
Return Type
Container !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| source | Directory ! | - | the directory containing the application files |
Example
dagger -m github.com/fixentropy-io/daggerverse@a69d402f01017086828f9d8bdbe5dba968d81433 call \
mount-app-with --source DIR_PATHfunc (m *MyModule) Example(source *dagger.Directory) *dagger.Container {
return dag.
Dragee().
MountAppWith(source)
}@function
def example(source: dagger.Directory) -> dagger.Container:
return (
dag.dragee()
.mount_app_with(source)
)@func()
example(source: Directory): Container {
return dag
.dragee()
.mountAppWith(source)
}test() 🔗
It runs the tests of the project
Return Type
Container !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| app | Container ! | - | The container containing the project to test |
Example
dagger -m github.com/fixentropy-io/daggerverse@a69d402f01017086828f9d8bdbe5dba968d81433 call \
test --app IMAGE:TAGfunc (m *MyModule) Example(app *dagger.Container) *dagger.Container {
return dag.
Dragee().
Test(app)
}@function
def example(app: dagger.Container) -> dagger.Container:
return (
dag.dragee()
.test(app)
)@func()
example(app: Container): Container {
return dag
.dragee()
.test(app)
}lint() 🔗
This function runs the lint of the project on a bun container
Return Type
Container !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| app | Container ! | - | the container to run the lint on |
Example
dagger -m github.com/fixentropy-io/daggerverse@a69d402f01017086828f9d8bdbe5dba968d81433 call \
lint --app IMAGE:TAGfunc (m *MyModule) Example(app *dagger.Container) *dagger.Container {
return dag.
Dragee().
Lint(app)
}@function
def example(app: dagger.Container) -> dagger.Container:
return (
dag.dragee()
.lint(app)
)@func()
example(app: Container): Container {
return dag
.dragee()
.lint(app)
}build() 🔗
This function mounts the application and runs the build of the project on a bun container
Return Type
Container !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| app | Directory ! | - | the directory containing the project to build |
Example
dagger -m github.com/fixentropy-io/daggerverse@a69d402f01017086828f9d8bdbe5dba968d81433 call \
build --app DIR_PATHfunc (m *MyModule) Example(app *dagger.Directory) *dagger.Container {
return dag.
Dragee().
Build(app)
}@function
def example(app: dagger.Directory) -> dagger.Container:
return (
dag.dragee()
.build(app)
)@func()
example(app: Directory): Container {
return dag
.dragee()
.build(app)
}onPullRequest() 🔗
This function runs the lint and test of the project on a pull request trigger
Return Type
Void !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| url | String ! | - | - the repository url (it can either be a http or a git url) |
| branch | String ! | "main" | - the branch to use - defaults to `main` |
Example
dagger -m github.com/fixentropy-io/daggerverse@a69d402f01017086828f9d8bdbe5dba968d81433 call \
on-pull-request --url string --branch stringfunc (m *MyModule) Example(ctx context.Context, url string, branch string) {
return dag.
Dragee().
OnPullRequest(ctx, url, branch)
}@function
async def example(url: str, branch: str) -> None:
return await (
dag.dragee()
.on_pull_request(url, branch)
)@func()
async example(url: string, branch: string): Promise<void> {
return dag
.dragee()
.onPullRequest(url, branch)
}lintAndTest() 🔗
This function runs the lint and test of the project
Return Type
Container !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| source | Directory ! | - | the source directory |
Example
dagger -m github.com/fixentropy-io/daggerverse@a69d402f01017086828f9d8bdbe5dba968d81433 call \
lint-and-test --source DIR_PATHfunc (m *MyModule) Example(source *dagger.Directory) *dagger.Container {
return dag.
Dragee().
LintAndTest(source)
}@function
def example(source: dagger.Directory) -> dagger.Container:
return (
dag.dragee()
.lint_and_test(source)
)@func()
example(source: Directory): Container {
return dag
.dragee()
.lintAndTest(source)
}onPublish() 🔗
This function is executed when a release is triggered and will lint, test, build, bump the package version and publish it to npm registry You can call this function in different ways:
dagger call on-publish npm-token=env:NPM_TOKEN source=<path/to/source> tag=v1.0.0
or
dagger call on-publish npm-token=env:NPM_TOKEN git-url=https://github.com/dragee-io/dragee-io.git branch=main tag=v1.0.0
or
dagger call on-publish npm-token=env:NPM_TOKEN git-url=https://github.com/dragee-io/dragee-io.git branch=main
Return Type
Void !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| npmToken | Secret ! | - | is the npm token to use to publish the project |
| source | Directory | - | the source directory to use - if not provided, will pull the repository if the git_url and branch are provided |
| gitUrl | String | - | the git url of the repository |
| branch | String | - | the branch to use |
| tag | String | - | the tag version to release the package to - if not provided, will use the latest tag created on the repository |
Example
dagger -m github.com/fixentropy-io/daggerverse@a69d402f01017086828f9d8bdbe5dba968d81433 call \
on-publish --npm-token env:MYSECRETfunc (m *MyModule) Example(ctx context.Context, npmToken *dagger.Secret) {
return dag.
Dragee().
OnPublish(ctx, npmToken)
}@function
async def example(npm_token: dagger.Secret) -> None:
return await (
dag.dragee()
.on_publish(npm_token)
)@func()
async example(npmToken: Secret): Promise<void> {
return dag
.dragee()
.onPublish(npmToken)
}publishRelease() 🔗
This function is executed to publish a release when it is triggered. The following operations are executed in this order: 1. Retrieve sources from Git 2. Lint the app 3. Test the app 4. Build the app 5. Bump the package version 6. Publish the app to npm registry
Return Type
Void !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| oidcUrl | String ! | - | the OIDC URL to use for the token request |
| oidcToken | String ! | - | the OIDC token to use for the publish (pass as env:ACTIONS_ID_TOKEN_REQUEST_TOKEN) |
| gitUrl | String ! | - | the git url of the repository to clone and publish |
Example
dagger -m github.com/fixentropy-io/daggerverse@a69d402f01017086828f9d8bdbe5dba968d81433 call \
publish-release --oidc-url string --oidc-token string --git-url stringfunc (m *MyModule) Example(ctx context.Context, oidcUrl string, oidcToken string, gitUrl string) {
return dag.
Dragee().
PublishRelease(ctx, oidcUrl, oidcToken, gitUrl)
}@function
async def example(oidc_url: str, oidc_token: str, git_url: str) -> None:
return await (
dag.dragee()
.publish_release(oidc_url, oidc_token, git_url)
)@func()
async example(oidcUrl: string, oidcToken: string, gitUrl: string): Promise<void> {
return dag
.dragee()
.publishRelease(oidcUrl, oidcToken, gitUrl)
}publish() 🔗
This function works as on_publish but will not run the build step
Return Type
Void !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| npmToken | Secret ! | - | No description provided |
| source | Directory | - | No description provided |
| gitUrl | String | - | No description provided |
| branch | String | - | No description provided |
| tag | String | - | No description provided |
Example
dagger -m github.com/fixentropy-io/daggerverse@a69d402f01017086828f9d8bdbe5dba968d81433 call \
publish --npm-token env:MYSECRETfunc (m *MyModule) Example(ctx context.Context, npmToken *dagger.Secret) {
return dag.
Dragee().
Publish(ctx, npmToken)
}@function
async def example(npm_token: dagger.Secret) -> None:
return await (
dag.dragee()
.publish(npm_token)
)@func()
async example(npmToken: Secret): Promise<void> {
return dag
.dragee()
.publish(npmToken)
}bumpAndPublish() 🔗
Bumps the version of the app and publishes it to npm
Return Type
Container !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| tag | String ! | - | the tag to use for the version bump |
| source | Directory ! | - | the source directory of the project to bump the version |
| npmToken | Secret ! | - | the npm token to use for the publish |
Example
dagger -m github.com/fixentropy-io/daggerverse@a69d402f01017086828f9d8bdbe5dba968d81433 call \
bump-and-publish --tag string --source DIR_PATH --npm-token env:MYSECRETfunc (m *MyModule) Example(tag string, source *dagger.Directory, npmToken *dagger.Secret) *dagger.Container {
return dag.
Dragee().
BumpAndPublish(tag, source, npmToken)
}@function
def example(tag: str, source: dagger.Directory, npm_token: dagger.Secret) -> dagger.Container:
return (
dag.dragee()
.bump_and_publish(tag, source, npm_token)
)@func()
example(tag: string, source: Directory, npmToken: Secret): Container {
return dag
.dragee()
.bumpAndPublish(tag, source, npmToken)
}publishApp() 🔗
Publishes the app to npm
Return Type
Container !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| app | Container ! | - | the app to publish |
| npmToken | Secret ! | - | the npm token to use for the publish |
Example
dagger -m github.com/fixentropy-io/daggerverse@a69d402f01017086828f9d8bdbe5dba968d81433 call \
publish-app --app IMAGE:TAG --npm-token env:MYSECRETfunc (m *MyModule) Example(app *dagger.Container, npmToken *dagger.Secret) *dagger.Container {
return dag.
Dragee().
PublishApp(app, npmToken)
}@function
def example(app: dagger.Container, npm_token: dagger.Secret) -> dagger.Container:
return (
dag.dragee()
.publish_app(app, npm_token)
)@func()
example(app: Container, npmToken: Secret): Container {
return dag
.dragee()
.publishApp(app, npmToken)
}updateAppVersion() 🔗
Updates the version of the app
Return Type
Container !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| version | String ! | - | the version to update to |
| source | Directory ! | - | the source directory of the project to update the version |
Example
dagger -m github.com/fixentropy-io/daggerverse@a69d402f01017086828f9d8bdbe5dba968d81433 call \
update-app-version --version string --source DIR_PATHfunc (m *MyModule) Example(version string, source *dagger.Directory) *dagger.Container {
return dag.
Dragee().
UpdateAppVersion(version, source)
}@function
def example(version: str, source: dagger.Directory) -> dagger.Container:
return (
dag.dragee()
.update_app_version(version, source)
)@func()
example(version: string, source: Directory): Container {
return dag
.dragee()
.updateAppVersion(version, source)
}getLatestTag() 🔗
Gets the latest tag of the repository
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| url | String ! | - | the url of the repository |
Example
dagger -m github.com/fixentropy-io/daggerverse@a69d402f01017086828f9d8bdbe5dba968d81433 call \
get-latest-tag --url stringfunc (m *MyModule) Example(ctx context.Context, url string) string {
return dag.
Dragee().
GetLatestTag(ctx, url)
}@function
async def example(url: str) -> str:
return await (
dag.dragee()
.get_latest_tag(url)
)@func()
async example(url: string): Promise<string> {
return dag
.dragee()
.getLatestTag(url)
}