Skip to content

Commit

Permalink
update dagger 0.9.3
Browse files Browse the repository at this point in the history
Signed-off-by: Kyle Penfound <[email protected]>
Signed-off-by: Jeremy Adams <[email protected]>
Co-authored-by: Jeremy Adams <[email protected]>
  • Loading branch information
kpenfound and jpadams committed Nov 13, 2023
1 parent b5b6245 commit e0060f9
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 148 deletions.
1 change: 0 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
Expand Down
138 changes: 17 additions & 121 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,129 +1,25 @@
![Dagger](.github/dagger.png)
# dagger-for-github

[![GitHub release](https://img.shields.io/github/release/dagger/dagger-for-github.svg?style=flat-square)](https://github.com/dagger/dagger-for-github/releases/latest)
[![GitHub marketplace](https://img.shields.io/badge/marketplace-dagger--action-blue?logo=github&style=flat-square)](https://github.com/marketplace/actions/dagger-for-github)
[![Test workflow](https://img.shields.io/github/workflow/status/dagger/dagger-for-github/test?label=test&logo=github&style=flat-square)](https://github.com/dagger/dagger-for-github/actions?workflow=test)
[![Codecov](https://img.shields.io/codecov/c/github/dagger/dagger-for-github?logo=codecov&style=flat-square)](https://codecov.io/gh/dagger/dagger-for-github)

## About

GitHub Action for [Dagger](https://dagger.io), a programmable deployment system.

![Screenshot](.github/dagger-for-github.png)

___

* [Usage](#usage)
* [Basic](#basic)
* [Install Only](#install-only)
* [Multiple commands](#multiple-commands)
* [Customizing](#customizing)
* [inputs](#inputs)
* [License](#license)

## Usage

### Basic
Github action to run Dagger

```yaml
name: dagger

on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Dagger
uses: dagger/dagger-for-github@v4
with:
cmds: do test
- name: Dagger
uses: dagger/dagger-for-github@v5
with:
module: github.com/kpenfound/greetings-api/ci
args: ci --commit $GITHUB_SHA
cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }}
```
### Install Only
or with more options:
```yaml
steps:
-
name: Install Dagger
uses: dagger/dagger-for-github@v4
with:
install-only: true
-
name: Show Dagger version
run: dagger-cue version
- name: Dagger
uses: dagger/dagger-for-github@v5
with:
module: github.com/kpenfound/greetings-api/ci
args: ci --commit $GITHUB_SHA
cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }}
version: "0.9.3"
verb: call
```
### Install Only and `--with`

```yaml
steps:
-
name: Install Dagger
uses: dagger/dagger-for-github@v4
with:
install-only: true
-
name: Build a subdir example
run: |
dagger-cue do build --log-format plain -with 'actions:build:subdir: ${{env.SUBDIR}}'
```

### Multiple commands

```yaml
steps:
-
name: Dagger
uses: dagger/dagger-for-github@v4
with:
cmds: |
project update
do test
```

## Customizing

### inputs

Following inputs can be used as `step.with` keys

> `List` type is a newline-delimited string
> ```yaml
> cmds: |
> project update
> do test
> ```

| Name | Type | Default | Description |
|----------------|--------|---------|----------------------------------------------------------------------------------------|
| `version` | String | `0.2.232` | Dagger version (e.g., `0.2.232`, `latest`, `https://github.com/dagger/dagger.git#main`) |
| `cmds` | List | | List of Dagger commands |
| `workdir` | String | `.` | Working directory (below repository root) |
| `install-only` | Bool | `false` | Just install Dagger |
| `cleanup` | Bool | `true` | Cleanup Dagger home folder at the end of a job |

## Development

```shell
# format code and build javascript artifacts
docker buildx bake pre-checkin
# validate all code has correctly formatted and built
docker buildx bake validate
# run tests
docker buildx bake test
```

## License

Apache-2.0 License. See `LICENSE` for more details.
56 changes: 30 additions & 26 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,40 @@
name: 'Dagger for GitHub'
description: 'GitHub Action for Dagger, a programmable deployment system'
author: 'dagger'
branding:
color: 'green'
icon: 'package'

description: 'Run dagger commands in Github Actions'
inputs:
version:
description: 'Dagger CUE version'
default: '0.2.232'
description: 'Dagger Version'
required: false
args:
description: 'Arguments to pass to Dagger'
default: '0.9.3'
dagger-flags:
description: 'Dagger CLI Flags'
required: false
deprecationMessage: 'Use cmds input instead'
cmds:
description: 'List of Dagger commands'
default: '-s'
verb:
description: 'CLI verb (call, download, up, functions, shell, query)'
required: false
workdir:
description: 'Working directory (below repository root)'
default: '.'
default: 'call'
cloud-token:
description: 'Dagger Cloud Token'
required: false
install-only:
description: 'Just install Dagger'
default: 'false'
default: ''
module:
description: 'Dagger module to call. Local or Git'
required: false
cleanup:
description: 'Cleanup Dagger home folder at the end of a job'
default: 'true'
default: '.'
args:
description: 'Arguments to pass to CLI'
required: false

default: ''
runs:
using: 'node16'
main: 'dist/index.js'
post: 'dist/index.js'
using: "composite"
steps:
- run: cd /usr/local && { curl -L https://dl.dagger.io/dagger/install.sh | DAGGER_VERSION=${{ inputs.version }} sh; cd -; }
shell: bash
- run: if ! [ -d ./.git ]; then git clone -b ${GITHUB_REF_NAME} --no-checkout https://github.com/${GITHUB_REPOSITORY} .; fi
shell: bash
- run: DAGGER_CLOUD_TOKEN=${{ inputs.cloud-token }} /usr/local/bin/dagger ${{ inputs.dagger-flags }} ${{ inputs.verb }} -m ${{ inputs.module }} ${{ inputs.args }}
shell: bash
- run: docker stop -t 300 $(docker ps --filter name="dagger-engine-*" -q)
shell: bash
if: ${{ always() }}

0 comments on commit e0060f9

Please sign in to comment.