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
|
Apache License
|
||||||
Version 2.0, January 2004
|
Version 2.0, January 2004
|
||||||
http://www.apache.org/licenses/
|
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)
|
Github action to run Dagger
|
||||||
[](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
|
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
name: dagger
|
- name: Dagger
|
||||||
|
uses: dagger/dagger-for-github@v5
|
||||||
on:
|
with:
|
||||||
push:
|
module: github.com/kpenfound/greetings-api/ci
|
||||||
branches:
|
args: ci --commit $GITHUB_SHA
|
||||||
- main
|
cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }}
|
||||||
|
|
||||||
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
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Install Only
|
or with more options:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
- name: Dagger
|
||||||
-
|
uses: dagger/dagger-for-github@v5
|
||||||
name: Install Dagger
|
with:
|
||||||
uses: dagger/dagger-for-github@v4
|
module: github.com/kpenfound/greetings-api/ci
|
||||||
with:
|
args: ci --commit $GITHUB_SHA
|
||||||
install-only: true
|
cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }}
|
||||||
-
|
version: "0.9.3"
|
||||||
name: Show Dagger version
|
verb: call
|
||||||
run: dagger-cue version
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### 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'
|
name: 'Dagger for GitHub'
|
||||||
description: 'GitHub Action for Dagger, a programmable deployment system'
|
description: 'Run dagger commands in Github Actions'
|
||||||
author: 'dagger'
|
|
||||||
branding:
|
|
||||||
color: 'green'
|
|
||||||
icon: 'package'
|
|
||||||
|
|
||||||
inputs:
|
inputs:
|
||||||
version:
|
version:
|
||||||
description: 'Dagger CUE version'
|
description: 'Dagger Version'
|
||||||
default: '0.2.232'
|
|
||||||
required: false
|
required: false
|
||||||
args:
|
default: '0.9.3'
|
||||||
description: 'Arguments to pass to Dagger'
|
dagger-flags:
|
||||||
|
description: 'Dagger CLI Flags'
|
||||||
required: false
|
required: false
|
||||||
deprecationMessage: 'Use cmds input instead'
|
default: '-s'
|
||||||
cmds:
|
verb:
|
||||||
description: 'List of Dagger commands'
|
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
|
required: false
|
||||||
workdir:
|
|
||||||
description: 'Working directory (below repository root)'
|
|
||||||
default: '.'
|
default: '.'
|
||||||
|
args:
|
||||||
|
description: 'Arguments to pass to CLI'
|
||||||
required: false
|
required: false
|
||||||
install-only:
|
default: ''
|
||||||
description: 'Just install Dagger'
|
|
||||||
default: 'false'
|
|
||||||
required: false
|
|
||||||
cleanup:
|
|
||||||
description: 'Cleanup Dagger home folder at the end of a job'
|
|
||||||
default: 'true'
|
|
||||||
required: false
|
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'node16'
|
using: "composite"
|
||||||
main: 'dist/index.js'
|
steps:
|
||||||
post: 'dist/index.js'
|
- 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