Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -248,3 +248,66 @@ jobs:
- name: "Test Install"
run: |
dagger core version

existing-install:
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
- name: "preinstall dagger"
run: |
curl -fsS https://dl.dagger.io/dagger/install.sh \
| BIN_DIR=/usr/local/bin DAGGER_VERSION="v0.18.17" sh
- name: "Install with version"
uses: ./
with:
version: "v0.18.16"
- name: "Test Install"
run: |
if [[ "$(dagger core version)" == "v0.18.16" ]]; then
exit 0
else
echo "Existing install was not overridden"
exit 1
fi

commit-install:
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
- name: "preinstall dagger"
run: |
curl -fsS https://dl.dagger.io/dagger/install.sh \
| BIN_DIR=/usr/local/bin DAGGER_VERSION="v0.18.17" sh
- name: "Install with version"
uses: ./
with:
commit: "71f2e104b045ddc3b0cc611b81370707bf21bc27"
- name: "Test Install"
run: |
if [[ "$(dagger version)" == *"v0.18.19-250918123923-71f2e104b045"* ]]; then
exit 0
else
echo "Existing install was not overridden"
exit 1
fi

latest-install:
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
- name: "preinstall dagger"
run: |
curl -fsS https://dl.dagger.io/dagger/install.sh \
| BIN_DIR=/usr/local/bin DAGGER_VERSION="v0.18.17" sh
- name: "Install with version"
uses: ./
with:
version: "latest"
- name: "Test Install"
run: |
if [[ "$(dagger version)" != "v0.18.17" ]]; then
exit 0
else
echo "Existing install was not overridden with latest"
exit 1
fi
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,18 @@ By setting the version to `latest`, this action will install the latest version

### All `with:` input parameter options

| Key | Description | Required | Default |
| -------------- | ----------------------------------------------------------- | -------- | ------------------ |
| `version` | Dagger Version | true | n/a use semver x.y.z or 'latest'
| `commit` | Dagger Dev Commit (overrides `version`) | false | '' |
| `dagger-flags` | Dagger CLI Flags | false | '--progress plain' |
| `verb` | CLI verb (call, run, download, up, functions, shell, query) | false | 'call' |
| `workdir` | The working directory in which to run the Dagger CLI | false | '.' |
| `cloud-token` | Dagger Cloud Token | false | '' |
| `module` | Dagger module to call. Local or Git | false | '' |
| `args` | Arguments to pass to CLI | false | '' |
| `call` | Arguments to pass to CLI (Alias for args with verb:call) | false | '' |
| `shell` | Arguments to pass to CLI (Alias for args with verb:shell) | false | '' |
| Key | Description | Required | Default |
| --------------- | ----------------------------------------------------------------- | -------- | ------------------ |
| `version` | Dagger Version. Use semver vX.Y.Z or 'latest' | true | 'latest' |
| `commit` | Dagger Dev Commit (overrides `version`) | false | '' |
| `dagger-flags` | Dagger CLI Flags | false | '--progress plain' |
| `verb` | CLI verb (call, run, download, up, functions, shell, query) | false | 'call' |
| `workdir` | The working directory in which to run the Dagger CLI | false | '.' |
| `cloud-token` | Dagger Cloud Token | false | '' |
| `module` | Dagger module to call. Local or Git | false | '' |
| `args` | Arguments to pass to CLI | false | '' |
| `call` | Arguments to pass to CLI (Alias for args with verb:call) | false | '' |
| `shell` | Arguments to pass to CLI (Alias for args with verb:shell) | false | '' |

### All output variables

Expand Down
24 changes: 19 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ name: "Dagger for GitHub"
description: "Run dagger commands in Github Actions"
inputs:
version:
description: "Dagger Version"
required: true
description: "Dagger Version. Use semver vX.Y.Z or 'latest'"
required: false
default: "latest"
commit:
description: "Dagger Dev Commit"
required: false
Expand Down Expand Up @@ -72,12 +73,25 @@ runs:
if [[ "$VERSION" == "latest" ]]; then
VERSION=
fi
latest=$(curl https://dl.dagger.io/dagger/versions/latest)

COMMIT=${{ inputs.commit }}

# The install.sh script creates path ${prefix_dir}/bin
curl -fsS https://dl.dagger.io/dagger/install.sh \
| BIN_DIR=${prefix_dir}/bin DAGGER_VERSION="$VERSION" DAGGER_COMMIT="$COMMIT" sh
if [[ -x "$(command -v dagger)" ]]; then
echo "::group::Checking dagger"
version="$(dagger --silent version | cut --fields 2 --delimiter ' ')"
echo "Found existing dagger version: $version"
if [[ "$version" == "$VERSION" ]] || [[ "$version" == "$latest" ]]; then
echo "dagger ${version} is already installed, skipping installation"
exit 0
fi
echo "::endgroup::"
fi

echo "::group::Installing dagger"
curl -fsSL https://dl.dagger.io/dagger/install.sh | \
BIN_DIR=${prefix_dir}/bin DAGGER_VERSION="$VERSION" DAGGER_COMMIT="$COMMIT" sh
echo "::endgroup::"

- id: assemble
if: inputs.call != '' || inputs.shell != '' || inputs.args != ''
Expand Down