|
1 | | -name: 'Setup DDEV in Github Workflows' |
2 | | -description: | |
3 | | - This action installs **DDEV** in your Github Workflow. |
| 1 | +name: 'Setup and start DDEV action' |
| 2 | +description: 'Set up your GitHub Actions workflow with DDEV' |
4 | 3 | author: 'Jonas Eberle and DDEV contributors' |
5 | | -runs: |
6 | | - using: 'node20' |
7 | | - main: 'lib/main.js' |
8 | | -branding: |
9 | | - icon: cpu |
10 | | - color: yellow |
| 4 | + |
11 | 5 | inputs: |
12 | 6 | ddevDir: |
13 | | - description: 'ddev project directory' |
| 7 | + description: 'Path to your DDEV project. This path needs to contain the .ddev/ directory.' |
14 | 8 | required: false |
15 | 9 | default: '.' |
| 10 | + |
16 | 11 | autostart: |
17 | | - description: 'Start ddev automatically' |
| 12 | + description: 'Starts your DDEV project immediately.' |
18 | 13 | required: false |
19 | | - default: true |
| 14 | + default: 'true' |
| 15 | + |
20 | 16 | version: |
21 | | - description: 'Install a specific ddev version, such as 1.22.4' |
| 17 | + description: 'Install a specific DDEV version. Example: 1.24.0' |
22 | 18 | required: false |
23 | 19 | default: 'latest' |
| 20 | + |
| 21 | + retryAttempts: |
| 22 | + description: 'Maximum number of retry attempts for DDEV installation and operations' |
| 23 | + required: false |
| 24 | + default: '5' |
| 25 | + |
| 26 | + initialDelay: |
| 27 | + description: 'Initial delay in seconds between retries' |
| 28 | + required: false |
| 29 | + default: '2' |
| 30 | + |
| 31 | + maxDelay: |
| 32 | + description: 'Maximum delay in seconds between retries' |
| 33 | + required: false |
| 34 | + default: '30' |
| 35 | + |
| 36 | + retryMultiplier: |
| 37 | + description: 'Delay multiplier for exponential backoff' |
| 38 | + required: false |
| 39 | + default: '2' |
| 40 | + |
| 41 | + jitterPercent: |
| 42 | + description: 'Jitter percentage (0-100) to add randomness to retry delays' |
| 43 | + required: false |
| 44 | + default: '25' |
| 45 | + |
| 46 | + installScriptUrl: |
| 47 | + description: 'URL to the DDEV installation script' |
| 48 | + required: true |
| 49 | + default: 'https://raw.githubusercontent.com/ddev/ddev/master/scripts/install_ddev.sh' |
| 50 | + |
| 51 | +runs: |
| 52 | + using: 'composite' |
| 53 | + steps: |
| 54 | + - name: Download DDEV install script |
| 55 | + shell: bash |
| 56 | + run: | |
| 57 | + "${{ github.action_path }}/scripts/retry.sh" \ |
| 58 | + --attempts "${{ inputs.retryAttempts }}" \ |
| 59 | + --initial-delay "${{ inputs.initialDelay }}" \ |
| 60 | + --max-delay "${{ inputs.maxDelay }}" \ |
| 61 | + --multiplier "${{ inputs.retryMultiplier }}" \ |
| 62 | + --jitter "${{ inputs.jitterPercent }}" \ |
| 63 | + --description "Download DDEV install script" \ |
| 64 | + -- curl -fsSL --retry 3 --retry-max-time 60 --retry-connrefused \ |
| 65 | + -o /tmp/install_ddev.sh \ |
| 66 | + "${{ inputs.installScriptUrl }}" |
| 67 | +
|
| 68 | + - name: Install DDEV |
| 69 | + shell: bash |
| 70 | + run: | |
| 71 | + if [[ '${{ inputs.version }}' != 'latest' ]]; then |
| 72 | + VERSION_ARG="v${{ inputs.version }}" |
| 73 | + echo "Installing DDEV version: ${VERSION_ARG}" |
| 74 | + else |
| 75 | + VERSION_ARG="" |
| 76 | + echo "Installing latest DDEV version" |
| 77 | + fi |
| 78 | + |
| 79 | + # Make installation script executable |
| 80 | + chmod +x /tmp/install_ddev.sh |
| 81 | + |
| 82 | + "${{ github.action_path }}/scripts/retry.sh" \ |
| 83 | + --attempts "${{ inputs.retryAttempts }}" \ |
| 84 | + --initial-delay "${{ inputs.initialDelay }}" \ |
| 85 | + --max-delay "${{ inputs.maxDelay }}" \ |
| 86 | + --multiplier "${{ inputs.retryMultiplier }}" \ |
| 87 | + --jitter "${{ inputs.jitterPercent }}" \ |
| 88 | + --description "DDEV installation" \ |
| 89 | + -- /tmp/install_ddev.sh ${VERSION_ARG} |
| 90 | +
|
| 91 | + - name: Start DDEV project |
| 92 | + shell: bash |
| 93 | + working-directory: ${{ inputs.ddevDir }} |
| 94 | + if: inputs.autostart == 'true' |
| 95 | + run: | |
| 96 | + ddev start |
| 97 | +
|
| 98 | +branding: |
| 99 | + icon: 'cpu' |
| 100 | + color: yellow |
0 commit comments