Skip to content

Commit

Permalink
Merge pull request #20 from deviantintegral/set-ddev-version
Browse files Browse the repository at this point in the history
Support installing a specific ddev version #13
  • Loading branch information
jonaseberle authored Nov 3, 2023
2 parents 62f2cdb + 69784e3 commit 3f54a5a
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 1 deletion.
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

0 comments on commit 3f54a5a

Please sign in to comment.