Skip to content

Commit 3f54a5a

Browse files
authored
Merge pull request #20 from deviantintegral/set-ddev-version
Support installing a specific ddev version #13
2 parents 62f2cdb + 69784e3 commit 3f54a5a

File tree

4 files changed

+40
-1
lines changed

4 files changed

+40
-1
lines changed

.github/workflows/main.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,21 @@ jobs:
88
fail-fast: false
99
matrix:
1010
os: [ubuntu-20.04, ubuntu-22.04]
11+
version: ['latest', '1.22.3']
1112
steps:
1213
- uses: actions/checkout@v4
1314
- uses: ./
1415
with:
1516
ddevDir: tests/fixtures/ddevProj1
1617
autostart: false
18+
version: ${{ matrix.version }}
19+
- name: ddev version
20+
run: |
21+
if [[ ${{ matrix.version }} == '1.22.3' ]]; then
22+
test "$(ddev --version)" == 'ddev version v1.22.3'
23+
else
24+
test "$(ddev --version)" != 'ddev version v1.22.3'
25+
fi
1726
- name: ddev stopped
1827
run: |
1928
cd tests/fixtures/ddevProj1

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,18 @@ default: `true`
5555
autostart: false
5656
```
5757

58+
#### version
59+
60+
Install a specific ddev version. The version must be available in ddev's apt repository.
61+
62+
default: `latest`
63+
64+
```yaml
65+
- uses: ddev/github-action-setup-ddev@v1
66+
with:
67+
version: 1.22.4
68+
```
69+
5870
## Common recipes
5971

6072
### SSH keys

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,7 @@ inputs:
1717
description: 'Start ddev automatically'
1818
required: false
1919
default: true
20+
version:
21+
description: 'Install a specific ddev version, such as 1.22.4'
22+
required: false
23+
default: 'latest'

lib/main.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,23 @@ function run() {
6565
cmd = 'echo "deb https://apt.fury.io/drud/ * *" | sudo tee -a /etc/apt/sources.list.d/ddev.list';
6666
console.log(cmd);
6767
yield execShellCommand(cmd);
68-
cmd = 'sudo apt-get update && sudo apt-get install -y ddev && mkcert -install';
68+
69+
const version = core.getInput('version') || 'latest';
70+
let ddevPackage = 'ddev';
71+
if (version !== 'latest') {
72+
ddevPackage += `=${version}`;
73+
}
74+
75+
cmd = `sudo apt-get update && sudo apt-get install -y ${ddevPackage} && mkcert -install`;
6976
console.log(cmd);
7077
yield execShellCommand(cmd);
78+
79+
if (version !== 'latest') {
80+
cmd = 'sudo apt-mark hold ddev';
81+
console.log(cmd);
82+
yield execShellCommand(cmd);
83+
}
84+
7185
cmd = 'ddev --version';
7286
console.log(cmd);
7387
yield execShellCommand(cmd);

0 commit comments

Comments
 (0)