mirror of
https://github.com/dagger/dagger-for-github.git
synced 2025-12-31 04:30:01 +11:00
update dagger 0.9.3
Signed-off-by: Kyle Penfound <kyle@dagger.io> Signed-off-by: Jeremy Adams <jeremy@dagger.io> Co-authored-by: Jeremy Adams <jeremy@dagger.io>
This commit is contained in:
parent
7815dae500
commit
ea1e4f41f5
3 changed files with 48 additions and 149 deletions
1
LICENSE
1
LICENSE
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
|
|
|||
138
README.md
138
README.md
|
|
@ -1,129 +1,25 @@
|
|||

|
||||
# dagger-for-github
|
||||
|
||||
[](https://github.com/dagger/dagger-for-github/releases/latest)
|
||||
[](https://github.com/marketplace/actions/dagger-for-github)
|
||||
[](https://github.com/dagger/dagger-for-github/actions?workflow=test)
|
||||
[](https://codecov.io/gh/dagger/dagger-for-github)
|
||||
|
||||
## About
|
||||
|
||||
GitHub Action for [Dagger](https://dagger.io), a programmable deployment system.
|
||||
|
||||

|
||||
|
||||
___
|
||||
|
||||
* [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.
|
||||
|
|
|
|||
58
action.yml
58
action.yml
|
|
@ -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
|
||||
default: 'call'
|
||||
cloud-token:
|
||||
description: 'Dagger Cloud Token'
|
||||
required: false
|
||||
default: ''
|
||||
module:
|
||||
description: 'Dagger module to call. Local or Git'
|
||||
required: false
|
||||
workdir:
|
||||
description: 'Working directory (below repository root)'
|
||||
default: '.'
|
||||
args:
|
||||
description: 'Arguments to pass to CLI'
|
||||
required: false
|
||||
install-only:
|
||||
description: 'Just install Dagger'
|
||||
default: 'false'
|
||||
required: false
|
||||
cleanup:
|
||||
description: 'Cleanup Dagger home folder at the end of a job'
|
||||
default: 'true'
|
||||
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() }}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue