Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support installing a specific ddev version #13 #20

Merged
merged 4 commits into from
Nov 3, 2023
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
9 changes: 9 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,21 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-20.04, ubuntu-22.04]
version: ['latest', '1.22.3']
steps:
- uses: actions/checkout@v4
- uses: ./
with:
ddevDir: tests/fixtures/ddevProj1
autostart: false
version: ${{ matrix.version }}
- name: ddev version
run: |
if [[ ${{ matrix.version }} == '1.22.3' ]]; then
test "$(ddev --version)" == 'ddev version v1.22.3'
else
test "$(ddev --version)" != 'ddev version v1.22.3'
fi
- name: ddev stopped
run: |
cd tests/fixtures/ddevProj1
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,18 @@ default: `true`
autostart: false
```

#### version

Install a specific ddev version. The version must be available in ddev's apt repository.

default: `latest`

```yaml
- uses: ddev/github-action-setup-ddev@v1
with:
version: 1.22.4
```

## Common recipes

### SSH keys
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ inputs:
description: 'Start ddev automatically'
required: false
default: true
version:
description: 'Install a specific ddev version, such as 1.22.4'
required: false
default: 'latest'
16 changes: 15 additions & 1 deletion lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,23 @@ function run() {
cmd = 'echo "deb https://apt.fury.io/drud/ * *" | sudo tee -a /etc/apt/sources.list.d/ddev.list';
console.log(cmd);
yield execShellCommand(cmd);
cmd = 'sudo apt-get update && sudo apt-get install -y ddev && mkcert -install';

const version = core.getInput('version') || 'latest';
let ddevPackage = 'ddev';
if (version !== 'latest') {
ddevPackage += `=${version}`;
}

cmd = `sudo apt-get update && sudo apt-get install -y ${ddevPackage} && mkcert -install`;
console.log(cmd);
yield execShellCommand(cmd);

if (version !== 'latest') {
cmd = 'sudo apt-mark hold ddev';
console.log(cmd);
yield execShellCommand(cmd);
}

cmd = 'ddev --version';
console.log(cmd);
yield execShellCommand(cmd);
Expand Down