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
3 changes: 3 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ jobs:
ddev --version
if [[ ${{ matrix.version }} == '1.24.8' ]]; then
test "$(ddev --version)" == 'ddev version v1.24.8'
elif [[ ${{ matrix.version }} == 'head' ]]; then
# A build of main has a -g<sha> suffix, which the stable release lacks
[[ "$(ddev --version)" =~ -g[0-9a-f]+$ ]]
else
test "$(ddev --version)" != 'ddev version v1.24.8'
fi
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ default: `true`

### version

Install a specific ddev version. The version must be available in ddev's apt repository.
Install a specific ddev version, such as `1.24.8`, the latest stable release with `latest`, or the latest build of ddev's `main` branch with `head`.

default: `latest`

Expand All @@ -87,6 +87,8 @@ default: `latest`
version: 1.24.8
```

`head` installs the latest stable release first, then replaces it with the `main` build using `ddev utility download-ddev --head`. The action passes the workflow's own token, so the build comes from GitHub directly rather than through [nightly.link](https://nightly.link).

### installScriptUrl

URL to the DDEV installation script. This allows you to specify a custom or alternative source for the DDEV installation script.
Expand Down
48 changes: 34 additions & 14 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ inputs:
default: 'true'

version:
description: 'Install a specific DDEV version. Example: 1.24.0'
description: 'DDEV version to install: latest (the default), head (the latest build of the main branch), or a release number such as 1.24.8'
required: false
default: 'latest'

Expand All @@ -28,33 +28,53 @@ runs:
steps:
- name: Download DDEV install script
shell: bash
env:
INSTALL_SCRIPT_URL: ${{ inputs.installScriptUrl }}
run: |
if [[ '${{ inputs.version }}' == 'head' && '${{ inputs.installScriptUrl }}' == 'https://ddev.com/install.sh' ]]; then
SCRIPT_URL="https://raw.githubusercontent.com/ddev/ddev/main/scripts/install_ddev_head.sh"
echo "Using head version install script: ${SCRIPT_URL}"
else
SCRIPT_URL="${{ inputs.installScriptUrl }}"
fi
curl -fsSL --retry 3 --retry-max-time 60 --retry-connrefused -o /tmp/install_ddev.sh "${SCRIPT_URL}"
curl -fsSL --retry 3 --retry-max-time 60 --retry-connrefused -o /tmp/install_ddev.sh "${INSTALL_SCRIPT_URL}"

- name: Install DDEV
shell: bash
env:
DDEV_VERSION: ${{ inputs.version }}
run: |
if [[ '${{ inputs.version }}' == 'latest' ]]; then
if [[ "${DDEV_VERSION}" == 'latest' ]]; then
VERSION_ARG=""
echo "Installing latest stable DDEV version"
elif [[ '${{ inputs.version }}' == 'head' ]]; then
elif [[ "${DDEV_VERSION}" == 'head' ]]; then
# HEAD is installed by replacing the stable binaries in the next step
VERSION_ARG=""
echo "Installing DDEV HEAD version"
echo "Installing latest stable DDEV version, to be replaced with the HEAD build"
else
VERSION_ARG="v${{ inputs.version }}"
VERSION_ARG="v${DDEV_VERSION}"
echo "Installing DDEV version: ${VERSION_ARG}"
fi

# Make installation script executable
chmod +x /tmp/install_ddev.sh

/tmp/install_ddev.sh ${VERSION_ARG}

- name: Replace DDEV with the HEAD build
shell: bash
if: inputs.version == 'head'
env:
# With a token, download-ddev gets the build from GitHub directly,
# and uses nightly.link only if that fails
DDEV_GITHUB_TOKEN: ${{ github.token }}
run: |
head_dir="${RUNNER_TEMP}/ddev-head"
ddev utility download-ddev --head --output "${head_dir}"
# Overwrite the stable binaries in place, so ddev and ddev-hostname stay
# a matching pair wherever they are called from
ddev_dir="$(dirname "$(command -v ddev)")"
sudo install -m 0755 "${head_dir}/ddev" "${head_dir}/ddev-hostname" "${ddev_dir}/"
rm -rf "${head_dir}"
ddev --version

- name: Configure DDEV
shell: bash
run: |
ddev config global --instrumentation-opt-in=false --omit-containers=ddev-ssh-agent

- name: Start DDEV project
Expand Down