From f6bfda07ce2bd9ee84ee5d136cb8126a647b6977 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 11:17:39 -0400 Subject: [PATCH 001/138] First steps site.deploy.yml workflow. --- .github/workflows/site.deploy.yml | 81 +++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 .github/workflows/site.deploy.yml diff --git a/.github/workflows/site.deploy.yml b/.github/workflows/site.deploy.yml new file mode 100644 index 0000000..49d0920 --- /dev/null +++ b/.github/workflows/site.deploy.yml @@ -0,0 +1,81 @@ +on: + workflow_call: + inputs: + + git_repository: + required: true + type: string + description: The repository to deploy. + + git_reference: + required: true + type: string + description: The git reference to deploy. + + path: + required: true + type: string + description: The path to clone the repository into. (Use absolute paths. Otherwise it is relative to the github runner workspace, which is ephemeral.) + + sync_command: + default: ddev sync + type: string + description: The command to run to sync the site from your production instance. + + run_sync: + default: false + type: boolean + description: Whether to run the sync command. + + deploy_command: + default: ddev sync + type: string + description: The command to run after deploying new code. + + run_deploy: + default: true + type: boolean + description: Whether to run the deploy command. + + ddev_project_name: + type: string + default: ${{ github.event.repository.name }} + description: The ddev project name for this environment. Must be unique on this server. Will be used for the default domain using {ddev_project_name}.{ddev_project_tld}. + + ddev_project_tld: + type: string + description: The top-level domain used for the environment. + + ddev_config: + type: string + description: Extra ddev configuration for this environment to write to .ddev/config.zzz.workflow.yaml. Use to apply environment-specific configuration, additional_fqdns, etc. + + github_runs_on: + type: string + default: ubuntu-latest + description: The label of the runner you wish to use. + +jobs: + deploy-code: + runs-on: ${{ inputs.github_runs_on }} + steps: + - name: Hello world + run: | + echo "-----------------------------" + echo "Hello world!" + echo "-----------------------------" + echo "Who am I: $(whoami)" + echo "Hostname: $(hostname -f)" + echo "-----------------------------" + echo "Path: ${{ inputs.path }}" + echo "Git Reference: ${{ inputs.git_reference }}" + echo "Git Repository: ${{ inputs.git_repository }}" + echo "Sync Command: ${{ inputs.sync_command }}" + echo "Deploy Command: ${{ inputs.deploy_command }}" + echo "-----------------------------" + + echo "DDEV Config:" + echo "${{ inputs.ddev_config }}" + echo "Project Name: ${{ inputs.ddev_project_name }}" + echo "Project TLD: ${{ inputs.ddev_project_tld }}" + echo "-----------------------------" From 5140d01bd6fda84c30d4714d946b6ad295f69107 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 11:31:57 -0400 Subject: [PATCH 002/138] Add calling workflow. --- .github/workflows/site.preview.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/site.preview.yml diff --git a/.github/workflows/site.preview.yml b/.github/workflows/site.preview.yml new file mode 100644 index 0000000..b63bca0 --- /dev/null +++ b/.github/workflows/site.preview.yml @@ -0,0 +1,19 @@ +name: Deploy Preview Site +on: + pull_request: + +jobs: + deploy-site: + runs-on: ubuntu-latest + steps: + - name: Deploy Preview Site + uses: ./.github/workflows/ddev.site.deploy.yml + with: + git_root: /apps/ourproject/pr${{ github.event.number }} + ddev_project_name: ourproject.pr${{ github.event.number }} + ddev_project_tld: sites.thinkdrop.net + github_environment: pr${{ github.event.number }} + github_runs_on: ubuntu-latest + ddev_config: | + additional_fqdns: + - test.pr${{ github.event.number }}.sites.thinkdrop.net From 1e7bba0cb8884f39536d0ebfb1d69f5a140a8afd Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 11:32:12 -0400 Subject: [PATCH 003/138] Add environment and defaults. --- .../{site.deploy.yml => ddev.site.deploy.yml} | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) rename .github/workflows/{site.deploy.yml => ddev.site.deploy.yml} (83%) diff --git a/.github/workflows/site.deploy.yml b/.github/workflows/ddev.site.deploy.yml similarity index 83% rename from .github/workflows/site.deploy.yml rename to .github/workflows/ddev.site.deploy.yml index 49d0920..3dd3dd3 100644 --- a/.github/workflows/site.deploy.yml +++ b/.github/workflows/ddev.site.deploy.yml @@ -3,16 +3,18 @@ on: inputs: git_repository: + default: ${{ github.event.repository.clone_url }} required: true type: string description: The repository to deploy. git_reference: + default: ${{ github.head_ref || github.ref_name }} required: true type: string description: The git reference to deploy. - path: + git_root: required: true type: string description: The path to clone the repository into. (Use absolute paths. Otherwise it is relative to the github runner workspace, which is ephemeral.) @@ -28,7 +30,7 @@ on: description: Whether to run the sync command. deploy_command: - default: ddev sync + default: ddev drush deploy type: string description: The command to run after deploying new code. @@ -55,9 +57,19 @@ on: default: ubuntu-latest description: The label of the runner you wish to use. + github_environment: + type: string + default: ${{ github.head_ref || github.ref_name }} + description: The string to use as the github environment. + jobs: deploy-code: runs-on: ${{ inputs.github_runs_on }} + + environment: + name: ${{ inputs.github_environment }} + url: "http://${{ inputs.ddev_project_name }}.${{ inputs.ddev_project_tld }}?${{ github.run_id }}" + steps: - name: Hello world run: | From 3e99cf4eb7204985635b1354ecc3edd6da08b442 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 11:33:44 -0400 Subject: [PATCH 004/138] Try remote uses. --- .github/workflows/site.preview.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/site.preview.yml b/.github/workflows/site.preview.yml index b63bca0..d9f371d 100644 --- a/.github/workflows/site.preview.yml +++ b/.github/workflows/site.preview.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Deploy Preview Site - uses: ./.github/workflows/ddev.site.deploy.yml + uses: operations-project/github-action-ddev-runner/.github/workflows/ddev.site.deploy.yml with: git_root: /apps/ourproject/pr${{ github.event.number }} ddev_project_name: ourproject.pr${{ github.event.number }} From 6540e530516fe3575ce837f66a2d9076f1306905 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 11:34:28 -0400 Subject: [PATCH 005/138] Needs @ref --- .github/workflows/site.preview.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/site.preview.yml b/.github/workflows/site.preview.yml index d9f371d..a57f92b 100644 --- a/.github/workflows/site.preview.yml +++ b/.github/workflows/site.preview.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Deploy Preview Site - uses: operations-project/github-action-ddev-runner/.github/workflows/ddev.site.deploy.yml + uses: operations-project/github-action-ddev-runner/.github/workflows/ddev.site.deploy.yml@feature/reusable-workflows with: git_root: /apps/ourproject/pr${{ github.event.number }} ddev_project_name: ourproject.pr${{ github.event.number }} From 3c92469aea421e8f1cad38e4320f4dce49a95838 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 11:35:25 -0400 Subject: [PATCH 006/138] Reusable workflows are jobs. --- .github/workflows/site.preview.yml | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/.github/workflows/site.preview.yml b/.github/workflows/site.preview.yml index a57f92b..5a51354 100644 --- a/.github/workflows/site.preview.yml +++ b/.github/workflows/site.preview.yml @@ -4,16 +4,13 @@ on: jobs: deploy-site: - runs-on: ubuntu-latest - steps: - - name: Deploy Preview Site - uses: operations-project/github-action-ddev-runner/.github/workflows/ddev.site.deploy.yml@feature/reusable-workflows - with: - git_root: /apps/ourproject/pr${{ github.event.number }} - ddev_project_name: ourproject.pr${{ github.event.number }} - ddev_project_tld: sites.thinkdrop.net - github_environment: pr${{ github.event.number }} - github_runs_on: ubuntu-latest - ddev_config: | - additional_fqdns: - - test.pr${{ github.event.number }}.sites.thinkdrop.net + uses: operations-project/github-action-ddev-runner/.github/workflows/ddev.site.deploy.yml@feature/reusable-workflows + with: + git_root: /apps/ourproject/pr${{ github.event.number }} + ddev_project_name: ourproject.pr${{ github.event.number }} + ddev_project_tld: sites.thinkdrop.net + github_environment: pr${{ github.event.number }} + github_runs_on: ubuntu-latest + ddev_config: | + additional_fqdns: + - test.pr${{ github.event.number }}.sites.thinkdrop.net From 1f546fa99f311b95630e4a01fcb6501be6d3c160 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 11:36:11 -0400 Subject: [PATCH 007/138] Make not required since we can autodetect. --- .github/workflows/ddev.site.deploy.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ddev.site.deploy.yml b/.github/workflows/ddev.site.deploy.yml index 3dd3dd3..214b677 100644 --- a/.github/workflows/ddev.site.deploy.yml +++ b/.github/workflows/ddev.site.deploy.yml @@ -4,13 +4,11 @@ on: git_repository: default: ${{ github.event.repository.clone_url }} - required: true type: string description: The repository to deploy. git_reference: default: ${{ github.head_ref || github.ref_name }} - required: true type: string description: The git reference to deploy. From 2de44d190ddd1dbf10d3f83a3b04a1f7c394338c Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 11:38:53 -0400 Subject: [PATCH 008/138] Name jobs --- .github/workflows/ddev.site.deploy.yml | 1 + .github/workflows/site.preview.yml | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ddev.site.deploy.yml b/.github/workflows/ddev.site.deploy.yml index 214b677..6ff0949 100644 --- a/.github/workflows/ddev.site.deploy.yml +++ b/.github/workflows/ddev.site.deploy.yml @@ -62,6 +62,7 @@ on: jobs: deploy-code: + name: Deploy Code runs-on: ${{ inputs.github_runs_on }} environment: diff --git a/.github/workflows/site.preview.yml b/.github/workflows/site.preview.yml index 5a51354..e8f88f8 100644 --- a/.github/workflows/site.preview.yml +++ b/.github/workflows/site.preview.yml @@ -3,7 +3,8 @@ on: pull_request: jobs: - deploy-site: + create-site: + name: Create Preview Site uses: operations-project/github-action-ddev-runner/.github/workflows/ddev.site.deploy.yml@feature/reusable-workflows with: git_root: /apps/ourproject/pr${{ github.event.number }} From 41a689a254acf637a7799198782662713bb9b491 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 11:41:40 -0400 Subject: [PATCH 009/138] Add comments. --- .github/workflows/site.preview.yml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/site.preview.yml b/.github/workflows/site.preview.yml index e8f88f8..0398a51 100644 --- a/.github/workflows/site.preview.yml +++ b/.github/workflows/site.preview.yml @@ -7,11 +7,24 @@ jobs: name: Create Preview Site uses: operations-project/github-action-ddev-runner/.github/workflows/ddev.site.deploy.yml@feature/reusable-workflows with: + + # Configure your site here. git_root: /apps/ourproject/pr${{ github.event.number }} + + # Must be unique per server. ddev_project_name: ourproject.pr${{ github.event.number }} + + # Used to create a system domain. ddev_project_tld: sites.thinkdrop.net - github_environment: pr${{ github.event.number }} + + # Tell the remote workflow what to run on. github_runs_on: ubuntu-latest + + # Define a github environment name. + github_environment: pr${{ github.event.number }} + + # Additional ddev config to apply to the environment. + # Will be saved to .ddev/config.zzz.runner.yaml ddev_config: | additional_fqdns: - - test.pr${{ github.event.number }}.sites.thinkdrop.net + - admin.pr${{ github.event.number }}.sites.thinkdrop.net From f65af2f97205c0e852243703209a4f8f04b17cf9 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 11:42:25 -0400 Subject: [PATCH 010/138] Add run_start input to control ddev start. --- .github/workflows/ddev.site.deploy.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ddev.site.deploy.yml b/.github/workflows/ddev.site.deploy.yml index 6ff0949..d55a092 100644 --- a/.github/workflows/ddev.site.deploy.yml +++ b/.github/workflows/ddev.site.deploy.yml @@ -17,6 +17,11 @@ on: type: string description: The path to clone the repository into. (Use absolute paths. Otherwise it is relative to the github runner workspace, which is ephemeral.) + run_start: + default: false + type: boolean + description: Whether to run the ddev start command. + sync_command: default: ddev sync type: string From 364bb837c83c76eca7b3d2f6dd04434767adfcca Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 11:44:09 -0400 Subject: [PATCH 011/138] Clone code. --- .github/workflows/ddev.site.deploy.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/ddev.site.deploy.yml b/.github/workflows/ddev.site.deploy.yml index d55a092..bb91883 100644 --- a/.github/workflows/ddev.site.deploy.yml +++ b/.github/workflows/ddev.site.deploy.yml @@ -95,3 +95,11 @@ jobs: echo "Project Name: ${{ inputs.ddev_project_name }}" echo "Project TLD: ${{ inputs.ddev_project_tld }}" echo "-----------------------------" + + - name: Clone code + run: | + git clone ${{ inputs.git_repository }} ${{ inputs.git_root }} || echo "Git repo exists at ${{ inputs.git_root }}." + cd ${{ inputs.git_root }} + git checkout ${{ inputs.git_reference }}" + echo "-----------------------------" + echo "Cloned code to ${{ inputs.git_root }}"" From eb3beb534b416d39d509a6c85449d59ba5f476a0 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 11:45:27 -0400 Subject: [PATCH 012/138] Clone code. --- .github/workflows/ddev.site.deploy.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ddev.site.deploy.yml b/.github/workflows/ddev.site.deploy.yml index bb91883..fe37e81 100644 --- a/.github/workflows/ddev.site.deploy.yml +++ b/.github/workflows/ddev.site.deploy.yml @@ -98,7 +98,9 @@ jobs: - name: Clone code run: | - git clone ${{ inputs.git_repository }} ${{ inputs.git_root }} || echo "Git repo exists at ${{ inputs.git_root }}." + if [[ ! -d ${{ inputs.git_root }} ]]; then + git clone ${{ inputs.git_repository }} ${{ inputs.git_root }} + fi cd ${{ inputs.git_root }} git checkout ${{ inputs.git_reference }}" echo "-----------------------------" From 7aa8dda4718088b39bed6cc0de51dcb3bad2807f Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 11:46:12 -0400 Subject: [PATCH 013/138] Put in home dir. --- .github/workflows/site.preview.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/site.preview.yml b/.github/workflows/site.preview.yml index 0398a51..b8879be 100644 --- a/.github/workflows/site.preview.yml +++ b/.github/workflows/site.preview.yml @@ -9,7 +9,7 @@ jobs: with: # Configure your site here. - git_root: /apps/ourproject/pr${{ github.event.number }} + git_root: /home/runner/ourproject/pr${{ github.event.number }} # Must be unique per server. ddev_project_name: ourproject.pr${{ github.event.number }} From 8eff1172474d9c0f549598957a34502f3cf2184c Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 11:47:06 -0400 Subject: [PATCH 014/138] Bad quotes. --- .github/workflows/ddev.site.deploy.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ddev.site.deploy.yml b/.github/workflows/ddev.site.deploy.yml index fe37e81..b316611 100644 --- a/.github/workflows/ddev.site.deploy.yml +++ b/.github/workflows/ddev.site.deploy.yml @@ -102,6 +102,6 @@ jobs: git clone ${{ inputs.git_repository }} ${{ inputs.git_root }} fi cd ${{ inputs.git_root }} - git checkout ${{ inputs.git_reference }}" - echo "-----------------------------" - echo "Cloned code to ${{ inputs.git_root }}"" + git checkout ${{ inputs.git_reference }} + echo ----------------------------- + echo "Cloned code to ${{ inputs.git_root }}" From 8e6abaee89f6c8abb8e76041b879508276fcd31a Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 11:48:44 -0400 Subject: [PATCH 015/138] add start site. --- .github/workflows/ddev.site.deploy.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ddev.site.deploy.yml b/.github/workflows/ddev.site.deploy.yml index b316611..6501cc0 100644 --- a/.github/workflows/ddev.site.deploy.yml +++ b/.github/workflows/ddev.site.deploy.yml @@ -105,3 +105,8 @@ jobs: git checkout ${{ inputs.git_reference }} echo ----------------------------- echo "Cloned code to ${{ inputs.git_root }}" + + - name: Start site + working-directory: ${{ inputs.git_root }} + run: | + ddev start From 5c7d711a298fe7211d04e471cb1ff98894c9ac8f Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 12:12:27 -0400 Subject: [PATCH 016/138] Add install ddev action. --- .github/workflows/ddev.site.deploy.yml | 6 ++++++ .github/workflows/site.preview.yml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ddev.site.deploy.yml b/.github/workflows/ddev.site.deploy.yml index 6501cc0..c927316 100644 --- a/.github/workflows/ddev.site.deploy.yml +++ b/.github/workflows/ddev.site.deploy.yml @@ -106,6 +106,12 @@ jobs: echo ----------------------------- echo "Cloned code to ${{ inputs.git_root }}" + # Not possible if runner is not root. + # @TODO: Only run if ddev is not installed, and we have root access. + # Leaving here for testing, for now. + - name: Setup DDEV + uses: ddev/github-action-setup-ddev@v1 + - name: Start site working-directory: ${{ inputs.git_root }} run: | diff --git a/.github/workflows/site.preview.yml b/.github/workflows/site.preview.yml index b8879be..e394f95 100644 --- a/.github/workflows/site.preview.yml +++ b/.github/workflows/site.preview.yml @@ -1,4 +1,4 @@ -name: Deploy Preview Site +name: Preview Sites on: pull_request: From 1ddad3b7b3206bf2e7a13a9393bf9d34a422f36e Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 12:17:44 -0400 Subject: [PATCH 017/138] Separate start site job. --- .github/workflows/ddev.site.deploy.yml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ddev.site.deploy.yml b/.github/workflows/ddev.site.deploy.yml index c927316..1dc5ad4 100644 --- a/.github/workflows/ddev.site.deploy.yml +++ b/.github/workflows/ddev.site.deploy.yml @@ -106,11 +106,24 @@ jobs: echo ----------------------------- echo "Cloned code to ${{ inputs.git_root }}" - # Not possible if runner is not root. - # @TODO: Only run if ddev is not installed, and we have root access. - # Leaving here for testing, for now. + start-site: + name: Start site + runs-on: ${{ inputs.github_runs_on }} + needs: deploy-code + + environment: + name: ${{ inputs.github_environment }} + url: "http://${{ inputs.ddev_project_name }}.${{ inputs.ddev_project_tld }}?${{ github.run_id }}" + + steps: + + # Install DDEV, if needed. + # This can only run if running in an isolated CI container with root access. + # @TODO: Figure out how to skip this if ddev already installed. - name: Setup DDEV uses: ddev/github-action-setup-ddev@v1 + with: + autostart: false - name: Start site working-directory: ${{ inputs.git_root }} From e95480db7daf3db8261e2ed00f61c16f014aeba4 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 14:30:45 -0400 Subject: [PATCH 018/138] Launch a test server in github actions infrastructure so the environment persists between jobs. --- .github/workflows/site.preview.yml | 33 ++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/.github/workflows/site.preview.yml b/.github/workflows/site.preview.yml index e394f95..ca7cece 100644 --- a/.github/workflows/site.preview.yml +++ b/.github/workflows/site.preview.yml @@ -2,7 +2,40 @@ name: Preview Sites on: pull_request: +env: + # https://github.com/operations-project/github-runner-starter/settings/secrets/actions/JONPUGH_GITHUB_TOKEN_ADMIN + GITHUB_TOKEN: "${{ secrets.JONPUGH_GITHUB_TOKEN_ADMIN }}" + RUNNER_CONFIG_NAME: "jonpugh@github-runner.${{ github.run_id }}" + jobs: + create-server: + name: Launch a test server + runs-on: ubuntu-latest + env: + # Set unique name for each item in the matrix. + RUNNER_CONFIG_NAME: "jonpugh@github-runner.${{ github.run_id }}.${{ matrix.runner }}" + + # Add consistent label for all runners. + RUNNER_CONFIG_LABELS: "jonpugh@github-runner.${{ github.run_id }}" + + strategy: + matrix: + # Create one runner for each job that needs to run, including the remote reusable workflow. + runner: [ 1,2,3 ] + steps: + - uses: actions/checkout@v4 + with: + repository: 'operations-project/github-runner-starter' + ref: 'v1.2.1' + + - name: "Run Job #${{ matrix.runner }}" + run: | + ./github-runner-starter \ + --run \ + --name=github.actions.runner.${{ github.run_id }}.${{ matrix.runner }} \ + --labels=${RUNNER_CONFIG_LABELS} \ + --config-sh-options=--ephemeral + create-site: name: Create Preview Site uses: operations-project/github-action-ddev-runner/.github/workflows/ddev.site.deploy.yml@feature/reusable-workflows From 7528a4b3edbc58dba6b954755403b67b02199a2e Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 14:34:33 -0400 Subject: [PATCH 019/138] inconsisten vars. --- .github/workflows/site.preview.yml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/.github/workflows/site.preview.yml b/.github/workflows/site.preview.yml index ca7cece..33acb4f 100644 --- a/.github/workflows/site.preview.yml +++ b/.github/workflows/site.preview.yml @@ -4,20 +4,12 @@ on: env: # https://github.com/operations-project/github-runner-starter/settings/secrets/actions/JONPUGH_GITHUB_TOKEN_ADMIN - GITHUB_TOKEN: "${{ secrets.JONPUGH_GITHUB_TOKEN_ADMIN }}" - RUNNER_CONFIG_NAME: "jonpugh@github-runner.${{ github.run_id }}" + GITHUB_TOKEN: "${{ secrets.OPERATIONS_GITHUB_TOKEN_ADMIN }}" jobs: create-server: name: Launch a test server runs-on: ubuntu-latest - env: - # Set unique name for each item in the matrix. - RUNNER_CONFIG_NAME: "jonpugh@github-runner.${{ github.run_id }}.${{ matrix.runner }}" - - # Add consistent label for all runners. - RUNNER_CONFIG_LABELS: "jonpugh@github-runner.${{ github.run_id }}" - strategy: matrix: # Create one runner for each job that needs to run, including the remote reusable workflow. @@ -33,7 +25,7 @@ jobs: ./github-runner-starter \ --run \ --name=github.actions.runner.${{ github.run_id }}.${{ matrix.runner }} \ - --labels=${RUNNER_CONFIG_LABELS} \ + --labels=github.actions.runner.${{ github.run_id }}.${{ matrix.runner }} \ --config-sh-options=--ephemeral create-site: From a2e0c00d65d14d3dbf098fa8daf98738db307989 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 14:35:15 -0400 Subject: [PATCH 020/138] runs-on. --- .github/workflows/site.preview.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/site.preview.yml b/.github/workflows/site.preview.yml index 33acb4f..683f3f6 100644 --- a/.github/workflows/site.preview.yml +++ b/.github/workflows/site.preview.yml @@ -43,7 +43,7 @@ jobs: ddev_project_tld: sites.thinkdrop.net # Tell the remote workflow what to run on. - github_runs_on: ubuntu-latest + github_runs_on: github.actions.runner.${{ github.run_id }}.${{ matrix.runner }} # Define a github environment name. github_environment: pr${{ github.event.number }} From 809cd425626f6b731da565af9da80a0b0abe3811 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 14:36:41 -0400 Subject: [PATCH 021/138] Wrong runs-on. --- .github/workflows/site.preview.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/site.preview.yml b/.github/workflows/site.preview.yml index 683f3f6..2f9be55 100644 --- a/.github/workflows/site.preview.yml +++ b/.github/workflows/site.preview.yml @@ -25,7 +25,7 @@ jobs: ./github-runner-starter \ --run \ --name=github.actions.runner.${{ github.run_id }}.${{ matrix.runner }} \ - --labels=github.actions.runner.${{ github.run_id }}.${{ matrix.runner }} \ + --labels=github.actions.runner.${{ github.run_id }} \ --config-sh-options=--ephemeral create-site: @@ -43,7 +43,7 @@ jobs: ddev_project_tld: sites.thinkdrop.net # Tell the remote workflow what to run on. - github_runs_on: github.actions.runner.${{ github.run_id }}.${{ matrix.runner }} + github_runs_on: github.actions.runner.${{ github.run_id }} # Define a github environment name. github_environment: pr${{ github.event.number }} From fc5d8f83ce80a594060f7de2542f8a3517e1c891 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 14:38:57 -0400 Subject: [PATCH 022/138] Cancel in progress. --- .github/workflows/site.preview.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/site.preview.yml b/.github/workflows/site.preview.yml index 2f9be55..6f1e3d7 100644 --- a/.github/workflows/site.preview.yml +++ b/.github/workflows/site.preview.yml @@ -6,6 +6,10 @@ env: # https://github.com/operations-project/github-runner-starter/settings/secrets/actions/JONPUGH_GITHUB_TOKEN_ADMIN GITHUB_TOKEN: "${{ secrets.OPERATIONS_GITHUB_TOKEN_ADMIN }}" +concurrency: + group: ${{ github.workflow }}-${{ github.event.number }} + cancel-in-progress: true + jobs: create-server: name: Launch a test server From 93b6cd8bcac63ee33fde5e477e671d85ff4a0711 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 15:08:27 -0400 Subject: [PATCH 023/138] Try unephemeral runner.... --- .github/workflows/site.preview.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/site.preview.yml b/.github/workflows/site.preview.yml index 6f1e3d7..df52108 100644 --- a/.github/workflows/site.preview.yml +++ b/.github/workflows/site.preview.yml @@ -14,23 +14,23 @@ jobs: create-server: name: Launch a test server runs-on: ubuntu-latest - strategy: - matrix: +# strategy: +# matrix: # Create one runner for each job that needs to run, including the remote reusable workflow. - runner: [ 1,2,3 ] +# runner: [ 1,2,3 ] steps: - uses: actions/checkout@v4 with: repository: 'operations-project/github-runner-starter' ref: 'v1.2.1' - - name: "Run Job #${{ matrix.runner }}" + - name: "Launch runner script." run: | ./github-runner-starter \ --run \ --name=github.actions.runner.${{ github.run_id }}.${{ matrix.runner }} \ - --labels=github.actions.runner.${{ github.run_id }} \ - --config-sh-options=--ephemeral + --labels=github.actions.runner.${{ github.run_id }} +# --config-sh-options=--ephemeral create-site: name: Create Preview Site From 7e41a53716aeaeb4b61eb92ecfd838708ff6ce6d Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 15:12:09 -0400 Subject: [PATCH 024/138] base ddev config --- .ddev/config.yaml | 280 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 280 insertions(+) create mode 100644 .ddev/config.yaml diff --git a/.ddev/config.yaml b/.ddev/config.yaml new file mode 100644 index 0000000..59233be --- /dev/null +++ b/.ddev/config.yaml @@ -0,0 +1,280 @@ +name: github-runner +type: php +docroot: web +php_version: "8.2" +webserver_type: nginx-fpm +xdebug_enabled: false +additional_hostnames: [] +additional_fqdns: [] +database: + type: mariadb + version: "10.11" +use_dns_when_possible: true +composer_version: "2" +web_environment: [] +corepack_enable: false + +# Key features of DDEV's config.yaml: + +# name: # Name of the project, automatically provides +# http://projectname.ddev.site and https://projectname.ddev.site + +# type: # backdrop, craftcms, django4, drupal, drupal6, drupal7, laravel, magento, magento2, php, python, shopware6, silverstripe, typo3, wordpress +# See https://ddev.readthedocs.io/en/stable/users/quickstart/ for more +# information on the different project types +# "drupal" covers recent Drupal 8+ + +# docroot: # Relative path to the directory containing index.php. + +# php_version: "8.2" # PHP version to use, "5.6", "7.0", "7.1", "7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3" + +# You can explicitly specify the webimage but this +# is not recommended, as the images are often closely tied to DDEV's' behavior, +# so this can break upgrades. + +# webimage: # nginx/php docker image. + +# database: +# type: # mysql, mariadb, postgres +# version: # database version, like "10.11" or "8.0" +# MariaDB versions can be 5.5-10.8 and 10.11, MySQL versions can be 5.5-8.0 +# PostgreSQL versions can be 9-16. + +# router_http_port: # Port to be used for http (defaults to global configuration, usually 80) +# router_https_port: # Port for https (defaults to global configuration, usually 443) + +# xdebug_enabled: false # Set to true to enable Xdebug and "ddev start" or "ddev restart" +# Note that for most people the commands +# "ddev xdebug" to enable Xdebug and "ddev xdebug off" to disable it work better, +# as leaving Xdebug enabled all the time is a big performance hit. + +# xhprof_enabled: false # Set to true to enable Xhprof and "ddev start" or "ddev restart" +# Note that for most people the commands +# "ddev xhprof" to enable Xhprof and "ddev xhprof off" to disable it work better, +# as leaving Xhprof enabled all the time is a big performance hit. + +# webserver_type: nginx-fpm, apache-fpm, or nginx-gunicorn + +# timezone: Europe/Berlin +# This is the timezone used in the containers and by PHP; +# it can be set to any valid timezone, +# see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones +# For example Europe/Dublin or MST7MDT + +# composer_root: +# Relative path to the Composer root directory from the project root. This is +# the directory which contains the composer.json and where all Composer related +# commands are executed. + +# composer_version: "2" +# You can set it to "" or "2" (default) for Composer v2 or "1" for Composer v1 +# to use the latest major version available at the time your container is built. +# It is also possible to use each other Composer version channel. This includes: +# - 2.2 (latest Composer LTS version) +# - stable +# - preview +# - snapshot +# Alternatively, an explicit Composer version may be specified, for example "2.2.18". +# To reinstall Composer after the image was built, run "ddev debug refresh". + +# nodejs_version: "20" +# change from the default system Node.js version to any other version. +# Numeric version numbers can be complete (i.e. 18.15.0) or +# incomplete (18, 17.2, 16). 'lts' and 'latest' can be used as well along with +# other named releases. +# see https://www.npmjs.com/package/n#specifying-nodejs-versions +# Note that you can continue using 'ddev nvm' or nvm inside the web container +# to change the project's installed node version if you need to. + +# corepack_enable: false +# Change to 'true' to 'corepack enable' and gain access to latest versions of yarn/pnpm + +# additional_hostnames: +# - somename +# - someothername +# would provide http and https URLs for "somename.ddev.site" +# and "someothername.ddev.site". + +# additional_fqdns: +# - example.com +# - sub1.example.com +# would provide http and https URLs for "example.com" and "sub1.example.com" +# Please take care with this because it can cause great confusion. + +# upload_dirs: "custom/upload/dir" +# +# upload_dirs: +# - custom/upload/dir +# - ../private +# +# would set the destination paths for ddev import-files to /custom/upload/dir +# When Mutagen is enabled this path is bind-mounted so that all the files +# in the upload_dirs don't have to be synced into Mutagen. + +# disable_upload_dirs_warning: false +# If true, turns off the normal warning that says +# "You have Mutagen enabled and your 'php' project type doesn't have upload_dirs set" + +# ddev_version_constraint: "" +# Example: +# ddev_version_constraint: ">= 1.22.4" +# This will enforce that the running ddev version is within this constraint. +# See https://github.com/Masterminds/semver#checking-version-constraints for +# supported constraint formats + +# working_dir: +# web: /var/www/html +# db: /home +# would set the default working directory for the web and db services. +# These values specify the destination directory for ddev ssh and the +# directory in which commands passed into ddev exec are run. + +# omit_containers: [db, ddev-ssh-agent] +# Currently only these containers are supported. Some containers can also be +# omitted globally in the ~/.ddev/global_config.yaml. Note that if you omit +# the "db" container, several standard features of DDEV that access the +# database container will be unusable. In the global configuration it is also +# possible to omit ddev-router, but not here. + +# performance_mode: "global" +# DDEV offers performance optimization strategies to improve the filesystem +# performance depending on your host system. Should be configured globally. +# +# If set, will override the global config. Possible values are: +# - "global": uses the value from the global config. +# - "none": disables performance optimization for this project. +# - "mutagen": enables Mutagen for this project. +# - "nfs": enables NFS for this project. +# +# See https://ddev.readthedocs.io/en/stable/users/install/performance/#nfs +# See https://ddev.readthedocs.io/en/stable/users/install/performance/#mutagen + +# fail_on_hook_fail: False +# Decide whether 'ddev start' should be interrupted by a failing hook + +# host_https_port: "59002" +# The host port binding for https can be explicitly specified. It is +# dynamic unless otherwise specified. +# This is not used by most people, most people use the *router* instead +# of the localhost port. + +# host_webserver_port: "59001" +# The host port binding for the ddev-webserver can be explicitly specified. It is +# dynamic unless otherwise specified. +# This is not used by most people, most people use the *router* instead +# of the localhost port. + +# host_db_port: "59002" +# The host port binding for the ddev-dbserver can be explicitly specified. It is dynamic +# unless explicitly specified. + +# mailpit_http_port: "8025" +# mailpit_https_port: "8026" +# The Mailpit ports can be changed from the default 8025 and 8026 + +# host_mailpit_port: "8025" +# The mailpit port is not normally bound on the host at all, instead being routed +# through ddev-router, but it can be bound directly to localhost if specified here. + +# webimage_extra_packages: [php7.4-tidy, php-bcmath] +# Extra Debian packages that are needed in the webimage can be added here + +# dbimage_extra_packages: [telnet,netcat] +# Extra Debian packages that are needed in the dbimage can be added here + +# use_dns_when_possible: true +# If the host has internet access and the domain configured can +# successfully be looked up, DNS will be used for hostname resolution +# instead of editing /etc/hosts +# Defaults to true + +# project_tld: ddev.site +# The top-level domain used for project URLs +# The default "ddev.site" allows DNS lookup via a wildcard +# If you prefer you can change this to "ddev.local" to preserve +# pre-v1.9 behavior. + +# ngrok_args: --basic-auth username:pass1234 +# Provide extra flags to the "ngrok http" command, see +# https://ngrok.com/docs/ngrok-agent/config or run "ngrok http -h" + +# disable_settings_management: false +# If true, DDEV will not create CMS-specific settings files like +# Drupal's settings.php/settings.ddev.php or TYPO3's AdditionalConfiguration.php +# In this case the user must provide all such settings. + +# You can inject environment variables into the web container with: +# web_environment: +# - SOMEENV=somevalue +# - SOMEOTHERENV=someothervalue + +# no_project_mount: false +# (Experimental) If true, DDEV will not mount the project into the web container; +# the user is responsible for mounting it manually or via a script. +# This is to enable experimentation with alternate file mounting strategies. +# For advanced users only! + +# bind_all_interfaces: false +# If true, host ports will be bound on all network interfaces, +# not the localhost interface only. This means that ports +# will be available on the local network if the host firewall +# allows it. + +# default_container_timeout: 120 +# The default time that DDEV waits for all containers to become ready can be increased from +# the default 120. This helps in importing huge databases, for example. + +#web_extra_exposed_ports: +#- name: nodejs +# container_port: 3000 +# http_port: 2999 +# https_port: 3000 +#- name: something +# container_port: 4000 +# https_port: 4000 +# http_port: 3999 +# Allows a set of extra ports to be exposed via ddev-router +# Fill in all three fields even if you don’t intend to use the https_port! +# If you don’t add https_port, then it defaults to 0 and ddev-router will fail to start. +# +# The port behavior on the ddev-webserver must be arranged separately, for example +# using web_extra_daemons. +# For example, with a web app on port 3000 inside the container, this config would +# expose that web app on https://.ddev.site:9999 and http://.ddev.site:9998 +# web_extra_exposed_ports: +# - name: myapp +# container_port: 3000 +# http_port: 9998 +# https_port: 9999 + +#web_extra_daemons: +#- name: "http-1" +# command: "/var/www/html/node_modules/.bin/http-server -p 3000" +# directory: /var/www/html +#- name: "http-2" +# command: "/var/www/html/node_modules/.bin/http-server /var/www/html/sub -p 3000" +# directory: /var/www/html + +# override_config: false +# By default, config.*.yaml files are *merged* into the configuration +# But this means that some things can't be overridden +# For example, if you have 'use_dns_when_possible: true'' you can't override it with a merge +# and you can't erase existing hooks or all environment variables. +# However, with "override_config: true" in a particular config.*.yaml file, +# 'use_dns_when_possible: false' can override the existing values, and +# hooks: +# post-start: [] +# or +# web_environment: [] +# or +# additional_hostnames: [] +# can have their intended affect. 'override_config' affects only behavior of the +# config.*.yaml file it exists in. + +# Many DDEV commands can be extended to run tasks before or after the +# DDEV command is executed, for example "post-start", "post-import-db", +# "pre-composer", "post-composer" +# See https://ddev.readthedocs.io/en/stable/users/extend/custom-commands/ for more +# information on the commands that can be extended and the tasks you can define +# for them. Example: +#hooks: From 1491f78037053ea5df712bcb100777309dbe9da4 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 15:19:04 -0400 Subject: [PATCH 025/138] Kick off the runner script over and over until there are no more queued jobs. --- .github/workflows/site.preview.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/site.preview.yml b/.github/workflows/site.preview.yml index df52108..47026c7 100644 --- a/.github/workflows/site.preview.yml +++ b/.github/workflows/site.preview.yml @@ -24,13 +24,16 @@ jobs: repository: 'operations-project/github-runner-starter' ref: 'v1.2.1' + # Kick off the runner script over and over until there are no more queued jobs. - name: "Launch runner script." run: | - ./github-runner-starter \ + while [[ $(curl -s -H "Authorization: token ${{ GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/jobs" | jq -r '.jobs[] | select(.status=="queued") | .id' | wc -l) -gt 0 ]]; do + ./github-runner-starter \ --run \ --name=github.actions.runner.${{ github.run_id }}.${{ matrix.runner }} \ --labels=github.actions.runner.${{ github.run_id }} -# --config-sh-options=--ephemeral + --config-sh-options=--ephemeral + done create-site: name: Create Preview Site From 6e4cf0f5c712ec2bce94d7dc31593ea5208f0662 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 15:19:52 -0400 Subject: [PATCH 026/138] Use env var. --- .github/workflows/site.preview.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/site.preview.yml b/.github/workflows/site.preview.yml index 47026c7..8c7be08 100644 --- a/.github/workflows/site.preview.yml +++ b/.github/workflows/site.preview.yml @@ -27,7 +27,7 @@ jobs: # Kick off the runner script over and over until there are no more queued jobs. - name: "Launch runner script." run: | - while [[ $(curl -s -H "Authorization: token ${{ GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/jobs" | jq -r '.jobs[] | select(.status=="queued") | .id' | wc -l) -gt 0 ]]; do + while [[ $(curl -s -H "Authorization: token ${GITHUB_TOKEN}" "https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/jobs" | jq -r '.jobs[] | select(.status=="queued") | .id' | wc -l) -gt 0 ]]; do ./github-runner-starter \ --run \ --name=github.actions.runner.${{ github.run_id }}.${{ matrix.runner }} \ From 9e82b9d6860a2b75db1976205d6d39cfde177c81 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 15:21:06 -0400 Subject: [PATCH 027/138] Ephemeral. --- .github/workflows/site.preview.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/site.preview.yml b/.github/workflows/site.preview.yml index 8c7be08..171f827 100644 --- a/.github/workflows/site.preview.yml +++ b/.github/workflows/site.preview.yml @@ -31,7 +31,7 @@ jobs: ./github-runner-starter \ --run \ --name=github.actions.runner.${{ github.run_id }}.${{ matrix.runner }} \ - --labels=github.actions.runner.${{ github.run_id }} + --labels=github.actions.runner.${{ github.run_id }} \ --config-sh-options=--ephemeral done From 50b5f29f240f125b646a29a0c16205b6846b483c Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 17:02:13 -0400 Subject: [PATCH 028/138] Check for ddev installation so this works on self-hosted runners. --- .github/workflows/ddev.site.deploy.yml | 30 ++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/.github/workflows/ddev.site.deploy.yml b/.github/workflows/ddev.site.deploy.yml index 1dc5ad4..b4c6fc5 100644 --- a/.github/workflows/ddev.site.deploy.yml +++ b/.github/workflows/ddev.site.deploy.yml @@ -1,3 +1,10 @@ +# +# DDEV Site Deploy +# +# This reusable workflow clones and launches your DDEV projects. +# +# +# on: workflow_call: inputs: @@ -116,12 +123,35 @@ jobs: url: "http://${{ inputs.ddev_project_name }}.${{ inputs.ddev_project_tld }}?${{ github.run_id }}" steps: + - name: Check DDEV Installation + run: | + if [[ `command -v ddev` ]]; then + echo "DDEV is already installed." + echo "DDEV_INSTALLED=true" >> $GITHUB_ENV + else + echo "DDEV is not installed." + echo "DDEV_INSTALLED=false" >> $GITHUB_ENV + fi + + if [[ `sudo pwd` ]]; then + echo "Runner has sudo access." + echo "RUNNER_SUDO=true" >> $GITHUB_ENV + else + echo "Runner does not have sudo access." + echo "RUNNER_SUDO=false" >> $GITHUB_ENV + fi + + if [[ $DDEV_INSTALLED == "false" && $RUNNER_SUDO == "false" ]]; then + echo "Unable to continue. DDEV cannot be installed without sudo access." + exit 1 + fi # Install DDEV, if needed. # This can only run if running in an isolated CI container with root access. # @TODO: Figure out how to skip this if ddev already installed. - name: Setup DDEV uses: ddev/github-action-setup-ddev@v1 + if: ${{ env.DDEV_INSTALLED == 'false' }} with: autostart: false From e7684fefcda2cbfc956ccb8ec8515c1b4dc03790 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 17:05:23 -0400 Subject: [PATCH 029/138] Only create one deployment per run. --- .github/workflows/ddev.site.deploy.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/ddev.site.deploy.yml b/.github/workflows/ddev.site.deploy.yml index b4c6fc5..2e6749b 100644 --- a/.github/workflows/ddev.site.deploy.yml +++ b/.github/workflows/ddev.site.deploy.yml @@ -77,10 +77,6 @@ jobs: name: Deploy Code runs-on: ${{ inputs.github_runs_on }} - environment: - name: ${{ inputs.github_environment }} - url: "http://${{ inputs.ddev_project_name }}.${{ inputs.ddev_project_tld }}?${{ github.run_id }}" - steps: - name: Hello world run: | From eb748a38f8eea793abe7cda98a6e333e19c5802f Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 17:09:17 -0400 Subject: [PATCH 030/138] comment. --- .github/workflows/ddev.site.deploy.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ddev.site.deploy.yml b/.github/workflows/ddev.site.deploy.yml index 2e6749b..34594f1 100644 --- a/.github/workflows/ddev.site.deploy.yml +++ b/.github/workflows/ddev.site.deploy.yml @@ -143,8 +143,7 @@ jobs: fi # Install DDEV, if needed. - # This can only run if running in an isolated CI container with root access. - # @TODO: Figure out how to skip this if ddev already installed. + # This only works for runners by sudo users. Don't run it if ddev is already installed. - name: Setup DDEV uses: ddev/github-action-setup-ddev@v1 if: ${{ env.DDEV_INSTALLED == 'false' }} From a27d83f7c9e43c87062a097b1a2f279208e91286 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 18:01:16 -0400 Subject: [PATCH 031/138] Add prepare_command, start_command input vars. --- .github/workflows/ddev.site.deploy.yml | 54 +++++++++++++++++++------- 1 file changed, 41 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ddev.site.deploy.yml b/.github/workflows/ddev.site.deploy.yml index 34594f1..254619e 100644 --- a/.github/workflows/ddev.site.deploy.yml +++ b/.github/workflows/ddev.site.deploy.yml @@ -22,29 +22,36 @@ on: git_root: required: true type: string - description: The path to clone the repository into. (Use absolute paths. Otherwise it is relative to the github runner workspace, which is ephemeral.) + description: The path to clone the repository into, relative to the runner workspace. Use absolute paths when running a persistent server. - run_start: + start_command: + default: ddev start + type: string + description: The command to launch the site servers. + + run_start_command: default: false type: boolean description: Whether to run the ddev start command. - sync_command: - default: ddev sync + # AKA Sync or Install. + prepare_command: + default: ddev drush site:install type: string - description: The command to run to sync the site from your production instance. + description: The command to run to prepare site data, such as a sync script, migration or install profile. - run_sync: + run_prepare_command: + # False by default to prevent data loss. If there is no data, the prepare command will still be run. default: false type: boolean - description: Whether to run the sync command. + description: Whether to run the prepare command. deploy_command: default: ddev drush deploy type: string description: The command to run after deploying new code. - run_deploy: + run_deploy_command: default: true type: boolean description: Whether to run the deploy command. @@ -114,10 +121,6 @@ jobs: runs-on: ${{ inputs.github_runs_on }} needs: deploy-code - environment: - name: ${{ inputs.github_environment }} - url: "http://${{ inputs.ddev_project_name }}.${{ inputs.ddev_project_tld }}?${{ github.run_id }}" - steps: - name: Check DDEV Installation run: | @@ -151,6 +154,31 @@ jobs: autostart: false - name: Start site + if: ${{ inputs.run_start_command }} working-directory: ${{ inputs.git_root }} run: | - ddev start + ${{ input.start_command }} + + # Import, sync, install, etc. + prepare-data: + name: Prepare data + runs-on: ${{ inputs.github_runs_on }} + needs: start-site + + environment: + name: ${{ inputs.github_environment }} + url: "http://${{ inputs.ddev_project_name }}.${{ inputs.ddev_project_tld }}?${{ github.run_id }}" + + steps: + + - name: Prepare data + working-directory: ${{ inputs.git_root }} + if: ${{ inputs.run_prepare_command }} + run: | + ${{ inputs.prepare_command }} + + - name: Deploy command + working-directory: ${{ inputs.git_root }} + if: ${{ inputs.run_deploy_command }} + run: | + ${{ inputs.deploy_command }} From 53e1bf36d7bd3d2f7354c0b9ed582fe637be9cc8 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 18:08:11 -0400 Subject: [PATCH 032/138] Add vars for both environment and url. --- .github/workflows/ddev.site.deploy.yml | 56 ++++++++++++++------------ .github/workflows/site.preview.yml | 7 +++- 2 files changed, 36 insertions(+), 27 deletions(-) diff --git a/.github/workflows/ddev.site.deploy.yml b/.github/workflows/ddev.site.deploy.yml index 254619e..ccce92c 100644 --- a/.github/workflows/ddev.site.deploy.yml +++ b/.github/workflows/ddev.site.deploy.yml @@ -74,10 +74,15 @@ on: default: ubuntu-latest description: The label of the runner you wish to use. - github_environment: + github_environment_name: type: string default: ${{ github.head_ref || github.ref_name }} - description: The string to use as the github environment. + description: The string to use as the GitHub environment. + + github_environment_url: + type: string + default: ${{ inputs.ddev_project_name }}.${{ inputs.ddev_project_tld }} + description: The URL to use for the GitHub environment.. jobs: deploy-code: @@ -154,31 +159,32 @@ jobs: autostart: false - name: Start site - if: ${{ inputs.run_start_command }} working-directory: ${{ inputs.git_root }} + if: ${{ inputs.run_start_command }} run: | - ${{ input.start_command }} + ${{ inputs.start_command }} # Import, sync, install, etc. prepare-data: - name: Prepare data - runs-on: ${{ inputs.github_runs_on }} - needs: start-site - - environment: - name: ${{ inputs.github_environment }} - url: "http://${{ inputs.ddev_project_name }}.${{ inputs.ddev_project_tld }}?${{ github.run_id }}" - - steps: - - - name: Prepare data - working-directory: ${{ inputs.git_root }} - if: ${{ inputs.run_prepare_command }} - run: | - ${{ inputs.prepare_command }} - - - name: Deploy command - working-directory: ${{ inputs.git_root }} - if: ${{ inputs.run_deploy_command }} - run: | - ${{ inputs.deploy_command }} + name: Prepare data + runs-on: ${{ inputs.github_runs_on }} + needs: start-site + + # Show links to this environment in the UI to the site. + environment: + name: ${{ inputs.github_environment_name }} + url: "${{ inputs.github_environment_url }}" + + steps: + + - name: Prepare data + working-directory: ${{ inputs.git_root }} + if: ${{ inputs.run_prepare_command }} + run: | + ${{ inputs.prepare_command }} + + - name: Deploy command + working-directory: ${{ inputs.git_root }} + if: ${{ inputs.run_deploy_command }} + run: | + ${{ inputs.deploy_command }} diff --git a/.github/workflows/site.preview.yml b/.github/workflows/site.preview.yml index 171f827..dce775d 100644 --- a/.github/workflows/site.preview.yml +++ b/.github/workflows/site.preview.yml @@ -52,8 +52,11 @@ jobs: # Tell the remote workflow what to run on. github_runs_on: github.actions.runner.${{ github.run_id }} - # Define a github environment name. - github_environment: pr${{ github.event.number }} + # Define the github environment name, to be displayed in the UI. + github_environment_name: pr${{ github.event.number }} + + # Define a github environment url, a link to be shown on the pull request. + github_environment_url: pr${{ github.event.number }}.sites.thinkdrop.net # Additional ddev config to apply to the environment. # Will be saved to .ddev/config.zzz.runner.yaml From b98e85756d54f4711849df02f7507778fc3c54dd Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 18:15:14 -0400 Subject: [PATCH 033/138] remove comments. --- .github/workflows/site.preview.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/site.preview.yml b/.github/workflows/site.preview.yml index dce775d..e3dee39 100644 --- a/.github/workflows/site.preview.yml +++ b/.github/workflows/site.preview.yml @@ -14,10 +14,6 @@ jobs: create-server: name: Launch a test server runs-on: ubuntu-latest -# strategy: -# matrix: - # Create one runner for each job that needs to run, including the remote reusable workflow. -# runner: [ 1,2,3 ] steps: - uses: actions/checkout@v4 with: From 27fbf2990c637d658f016e80e132d4baa60a6e2e Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 19:22:29 -0400 Subject: [PATCH 034/138] Comments. --- .github/workflows/site.preview.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/site.preview.yml b/.github/workflows/site.preview.yml index e3dee39..3ae3d92 100644 --- a/.github/workflows/site.preview.yml +++ b/.github/workflows/site.preview.yml @@ -11,6 +11,8 @@ concurrency: cancel-in-progress: true jobs: + # This emulates a persistent server. The ddev.site.deploy.yml jobs require one. + # This job runs the rest. It will stay running until the last job is complete. create-server: name: Launch a test server runs-on: ubuntu-latest From c1d796271ba16742ed3c33662c90e8731c178ac2 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 19:32:45 -0400 Subject: [PATCH 035/138] Set example prepare and deploy command. --- .github/workflows/site.preview.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/site.preview.yml b/.github/workflows/site.preview.yml index 3ae3d92..80249ab 100644 --- a/.github/workflows/site.preview.yml +++ b/.github/workflows/site.preview.yml @@ -56,6 +56,13 @@ jobs: # Define a github environment url, a link to be shown on the pull request. github_environment_url: pr${{ github.event.number }}.sites.thinkdrop.net + # To persist a site's data, set "run_prepare_command" to false. + run_prepare_command: true + prepare_command: echo "Preparing site..." + + # Command to run after deploying code. + deploy_command: ddev exec echo "Hello from $(hostname)!" + # Additional ddev config to apply to the environment. # Will be saved to .ddev/config.zzz.runner.yaml ddev_config: | From daf03a8e9bf9f480671b23189fa9648165d917ce Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 19:36:41 -0400 Subject: [PATCH 036/138] Default start to true. --- .github/workflows/ddev.site.deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ddev.site.deploy.yml b/.github/workflows/ddev.site.deploy.yml index ccce92c..73a29f2 100644 --- a/.github/workflows/ddev.site.deploy.yml +++ b/.github/workflows/ddev.site.deploy.yml @@ -30,7 +30,7 @@ on: description: The command to launch the site servers. run_start_command: - default: false + default: true type: boolean description: Whether to run the ddev start command. From cc4262c618224d58e9f41c9ba01f51033b579ff3 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 19:37:56 -0400 Subject: [PATCH 037/138] Use proper URL. --- .github/workflows/site.preview.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/site.preview.yml b/.github/workflows/site.preview.yml index 80249ab..206fdfb 100644 --- a/.github/workflows/site.preview.yml +++ b/.github/workflows/site.preview.yml @@ -54,7 +54,7 @@ jobs: github_environment_name: pr${{ github.event.number }} # Define a github environment url, a link to be shown on the pull request. - github_environment_url: pr${{ github.event.number }}.sites.thinkdrop.net + github_environment_url: http://pr${{ github.event.number }}.sites.thinkdrop.net # To persist a site's data, set "run_prepare_command" to false. run_prepare_command: true From 8ddf328768d7e9648cec8256fcf38a4272755a07 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 19:46:05 -0400 Subject: [PATCH 038/138] Add run tests step. --- .github/workflows/site.preview.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/site.preview.yml b/.github/workflows/site.preview.yml index 206fdfb..f8a8964 100644 --- a/.github/workflows/site.preview.yml +++ b/.github/workflows/site.preview.yml @@ -68,3 +68,11 @@ jobs: ddev_config: | additional_fqdns: - admin.pr${{ github.event.number }}.sites.thinkdrop.net + + test-site: + name: Run tests + runs-on: github.actions.runner.${{ github.run_id }} + steps: + - name: Check homepage + run: | + curl -s http://pr${{ github.event.number }}.sites.thinkdrop.net \ No newline at end of file From 6882e79ffc1c9bce11fe1a70c70990cfa4d6806e Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 19:46:55 -0400 Subject: [PATCH 039/138] Needs --- .github/workflows/site.preview.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/site.preview.yml b/.github/workflows/site.preview.yml index f8a8964..a7d9fe4 100644 --- a/.github/workflows/site.preview.yml +++ b/.github/workflows/site.preview.yml @@ -71,6 +71,7 @@ jobs: test-site: name: Run tests + needs: create-site runs-on: github.actions.runner.${{ github.run_id }} steps: - name: Check homepage From da7cc39c3a93e5690573aa08ed19b256817c10e7 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 19:55:47 -0400 Subject: [PATCH 040/138] Check homepage. --- .github/workflows/site.preview.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/site.preview.yml b/.github/workflows/site.preview.yml index a7d9fe4..015841f 100644 --- a/.github/workflows/site.preview.yml +++ b/.github/workflows/site.preview.yml @@ -76,4 +76,6 @@ jobs: steps: - name: Check homepage run: | - curl -s http://pr${{ github.event.number }}.sites.thinkdrop.net \ No newline at end of file + curl -s https://github-runner.ddev.site +# Not writing ddev config yet. +# curl -s http://pr${{ github.event.number }}.sites.thinkdrop.net \ No newline at end of file From bd942a376926e64d3d1d9b14ff9cd89271d9f363 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 20:01:09 -0400 Subject: [PATCH 041/138] Check homepage. --- .github/workflows/site.preview.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/site.preview.yml b/.github/workflows/site.preview.yml index 015841f..fa2e222 100644 --- a/.github/workflows/site.preview.yml +++ b/.github/workflows/site.preview.yml @@ -74,8 +74,9 @@ jobs: needs: create-site runs-on: github.actions.runner.${{ github.run_id }} steps: - - name: Check homepage + - name: Check homepage for Hello World. run: | curl -s https://github-runner.ddev.site + curl -s https://github-runner.ddev.site | grep "Hello World!" # Not writing ddev config yet. # curl -s http://pr${{ github.event.number }}.sites.thinkdrop.net \ No newline at end of file From 254cab93f67b7be2a7209054e4f1713f13426ba4 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 20:03:50 -0400 Subject: [PATCH 042/138] Move ddev install to calling workflow. --- .github/workflows/ddev.site.deploy.yml | 8 -------- .github/workflows/site.preview.yml | 8 ++++++++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ddev.site.deploy.yml b/.github/workflows/ddev.site.deploy.yml index 73a29f2..7d2038d 100644 --- a/.github/workflows/ddev.site.deploy.yml +++ b/.github/workflows/ddev.site.deploy.yml @@ -150,14 +150,6 @@ jobs: exit 1 fi - # Install DDEV, if needed. - # This only works for runners by sudo users. Don't run it if ddev is already installed. - - name: Setup DDEV - uses: ddev/github-action-setup-ddev@v1 - if: ${{ env.DDEV_INSTALLED == 'false' }} - with: - autostart: false - - name: Start site working-directory: ${{ inputs.git_root }} if: ${{ inputs.run_start_command }} diff --git a/.github/workflows/site.preview.yml b/.github/workflows/site.preview.yml index fa2e222..0d50bb6 100644 --- a/.github/workflows/site.preview.yml +++ b/.github/workflows/site.preview.yml @@ -22,6 +22,14 @@ jobs: repository: 'operations-project/github-runner-starter' ref: 'v1.2.1' + # Install DDEV, if needed. + # This only works for runners by sudo users. Don't run it if ddev is already installed. + - name: Setup DDEV + uses: ddev/github-action-setup-ddev@v1 + if: ${{ env.DDEV_INSTALLED == 'false' }} + with: + autostart: false + # Kick off the runner script over and over until there are no more queued jobs. - name: "Launch runner script." run: | From c0d6295bf18e684e9729b6610b9baa9531665b0b Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 20:07:40 -0400 Subject: [PATCH 043/138] Put it back in the deploy workflow. --- .github/workflows/ddev.site.deploy.yml | 8 ++++++++ .github/workflows/site.preview.yml | 8 -------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ddev.site.deploy.yml b/.github/workflows/ddev.site.deploy.yml index 7d2038d..73a29f2 100644 --- a/.github/workflows/ddev.site.deploy.yml +++ b/.github/workflows/ddev.site.deploy.yml @@ -150,6 +150,14 @@ jobs: exit 1 fi + # Install DDEV, if needed. + # This only works for runners by sudo users. Don't run it if ddev is already installed. + - name: Setup DDEV + uses: ddev/github-action-setup-ddev@v1 + if: ${{ env.DDEV_INSTALLED == 'false' }} + with: + autostart: false + - name: Start site working-directory: ${{ inputs.git_root }} if: ${{ inputs.run_start_command }} diff --git a/.github/workflows/site.preview.yml b/.github/workflows/site.preview.yml index 0d50bb6..fa2e222 100644 --- a/.github/workflows/site.preview.yml +++ b/.github/workflows/site.preview.yml @@ -22,14 +22,6 @@ jobs: repository: 'operations-project/github-runner-starter' ref: 'v1.2.1' - # Install DDEV, if needed. - # This only works for runners by sudo users. Don't run it if ddev is already installed. - - name: Setup DDEV - uses: ddev/github-action-setup-ddev@v1 - if: ${{ env.DDEV_INSTALLED == 'false' }} - with: - autostart: false - # Kick off the runner script over and over until there are no more queued jobs. - name: "Launch runner script." run: | From 5bf0251e7a2f10d782fd740b5fd27755bc0a31c8 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 20:07:47 -0400 Subject: [PATCH 044/138] Add test file. --- tests/docroot/index.html | 1 + 1 file changed, 1 insertion(+) create mode 100644 tests/docroot/index.html diff --git a/tests/docroot/index.html b/tests/docroot/index.html new file mode 100644 index 0000000..c57eff5 --- /dev/null +++ b/tests/docroot/index.html @@ -0,0 +1 @@ +Hello World! \ No newline at end of file From 9937d0123ee30d61a790ae5365e961dad438a3a5 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 20:34:10 -0400 Subject: [PATCH 045/138] Set docroot --- .ddev/config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ddev/config.yaml b/.ddev/config.yaml index 59233be..2248d72 100644 --- a/.ddev/config.yaml +++ b/.ddev/config.yaml @@ -1,6 +1,6 @@ name: github-runner type: php -docroot: web +docroot: tests/docroot php_version: "8.2" webserver_type: nginx-fpm xdebug_enabled: false From c57b59980fc94aff22faa20c53ad5cbb8b0ce82e Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 20:36:04 -0400 Subject: [PATCH 046/138] Wrong var name --- .github/workflows/ddev.site.deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ddev.site.deploy.yml b/.github/workflows/ddev.site.deploy.yml index 73a29f2..1c8ad56 100644 --- a/.github/workflows/ddev.site.deploy.yml +++ b/.github/workflows/ddev.site.deploy.yml @@ -98,7 +98,7 @@ jobs: echo "Who am I: $(whoami)" echo "Hostname: $(hostname -f)" echo "-----------------------------" - echo "Path: ${{ inputs.path }}" + echo "Path: ${{ inputs.git_root }}" echo "Git Reference: ${{ inputs.git_reference }}" echo "Git Repository: ${{ inputs.git_repository }}" echo "Sync Command: ${{ inputs.sync_command }}" From 54a0ca7c412380b1d97c15e09633667eef99e4e0 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 20:53:33 -0400 Subject: [PATCH 047/138] Write ddev config. --- .github/workflows/ddev.site.deploy.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ddev.site.deploy.yml b/.github/workflows/ddev.site.deploy.yml index 1c8ad56..bac9038 100644 --- a/.github/workflows/ddev.site.deploy.yml +++ b/.github/workflows/ddev.site.deploy.yml @@ -69,6 +69,11 @@ on: type: string description: Extra ddev configuration for this environment to write to .ddev/config.zzz.workflow.yaml. Use to apply environment-specific configuration, additional_fqdns, etc. + ddev_config_filename: + default: "config.zzz.hosting.yaml" + type: string + description: The file to create in the .ddev folder to store the ddev configuration. + github_runs_on: type: string default: ubuntu-latest @@ -82,7 +87,7 @@ on: github_environment_url: type: string default: ${{ inputs.ddev_project_name }}.${{ inputs.ddev_project_tld }} - description: The URL to use for the GitHub environment.. + description: The URL to use for the GitHub environment. jobs: deploy-code: @@ -158,6 +163,14 @@ jobs: with: autostart: false + - name: Configure DDEV + working-directory: ${{ inputs.git_root }}/.ddev + run: | + echo "# DDEV Config created by GitHub workflow https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" > ${{ inputs.ddev_config_filename }} + echo "name: ${{ inputs.ddev_project_name }}" >> ${{ inputs.ddev_config_filename }} + echo "project_tld: ${{ inputs.ddev_project_tld }}" >> ${{ inputs.ddev_config_filename }} + echo "${{ inputs.ddev_config }}" >> .ddev/${{ inputs.ddev_config_filename }} + - name: Start site working-directory: ${{ inputs.git_root }} if: ${{ inputs.run_start_command }} From 07628982ec5fa3e043ff2cae3e722b7cf23ea19e Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 20:56:03 -0400 Subject: [PATCH 048/138] Sleep in case there's no tasks for a second. --- .github/workflows/site.preview.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/site.preview.yml b/.github/workflows/site.preview.yml index fa2e222..e9164cf 100644 --- a/.github/workflows/site.preview.yml +++ b/.github/workflows/site.preview.yml @@ -31,6 +31,7 @@ jobs: --name=github.actions.runner.${{ github.run_id }}.${{ matrix.runner }} \ --labels=github.actions.runner.${{ github.run_id }} \ --config-sh-options=--ephemeral + sleep 3 done create-site: From eb31a15943d1be1db27534c963f5c972cb8d3847 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 21:00:11 -0400 Subject: [PATCH 049/138] huh --- .github/workflows/ddev.site.deploy.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ddev.site.deploy.yml b/.github/workflows/ddev.site.deploy.yml index bac9038..22a9c56 100644 --- a/.github/workflows/ddev.site.deploy.yml +++ b/.github/workflows/ddev.site.deploy.yml @@ -166,6 +166,8 @@ jobs: - name: Configure DDEV working-directory: ${{ inputs.git_root }}/.ddev run: | + pwd + ls -la ${{ inputs.git_root }} echo "# DDEV Config created by GitHub workflow https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" > ${{ inputs.ddev_config_filename }} echo "name: ${{ inputs.ddev_project_name }}" >> ${{ inputs.ddev_config_filename }} echo "project_tld: ${{ inputs.ddev_project_tld }}" >> ${{ inputs.ddev_config_filename }} From d6b9543cdb786c05dfd976401adb63b765b04fbc Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 21:03:17 -0400 Subject: [PATCH 050/138] list current dir. --- .github/workflows/ddev.site.deploy.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ddev.site.deploy.yml b/.github/workflows/ddev.site.deploy.yml index 22a9c56..25adb1b 100644 --- a/.github/workflows/ddev.site.deploy.yml +++ b/.github/workflows/ddev.site.deploy.yml @@ -155,24 +155,24 @@ jobs: exit 1 fi - # Install DDEV, if needed. - # This only works for runners by sudo users. Don't run it if ddev is already installed. - - name: Setup DDEV - uses: ddev/github-action-setup-ddev@v1 - if: ${{ env.DDEV_INSTALLED == 'false' }} - with: - autostart: false - - name: Configure DDEV working-directory: ${{ inputs.git_root }}/.ddev run: | pwd - ls -la ${{ inputs.git_root }} + ls -la echo "# DDEV Config created by GitHub workflow https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" > ${{ inputs.ddev_config_filename }} echo "name: ${{ inputs.ddev_project_name }}" >> ${{ inputs.ddev_config_filename }} echo "project_tld: ${{ inputs.ddev_project_tld }}" >> ${{ inputs.ddev_config_filename }} echo "${{ inputs.ddev_config }}" >> .ddev/${{ inputs.ddev_config_filename }} + # Install DDEV, if needed. + # This only works for runners by sudo users. Don't run it if ddev is already installed. + - name: Setup DDEV + uses: ddev/github-action-setup-ddev@v1 + if: ${{ env.DDEV_INSTALLED == 'false' }} + with: + autostart: false + - name: Start site working-directory: ${{ inputs.git_root }} if: ${{ inputs.run_start_command }} From 10e2bc7bfbe3e7c64d9c8df61aecc6236c814806 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 26 Sep 2025 21:10:09 -0400 Subject: [PATCH 051/138] fix path. --- .github/workflows/ddev.site.deploy.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/ddev.site.deploy.yml b/.github/workflows/ddev.site.deploy.yml index 25adb1b..962e2c6 100644 --- a/.github/workflows/ddev.site.deploy.yml +++ b/.github/workflows/ddev.site.deploy.yml @@ -158,12 +158,10 @@ jobs: - name: Configure DDEV working-directory: ${{ inputs.git_root }}/.ddev run: | - pwd - ls -la echo "# DDEV Config created by GitHub workflow https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" > ${{ inputs.ddev_config_filename }} echo "name: ${{ inputs.ddev_project_name }}" >> ${{ inputs.ddev_config_filename }} echo "project_tld: ${{ inputs.ddev_project_tld }}" >> ${{ inputs.ddev_config_filename }} - echo "${{ inputs.ddev_config }}" >> .ddev/${{ inputs.ddev_config_filename }} + echo "${{ inputs.ddev_config }}" >> ${{ inputs.ddev_config_filename }} # Install DDEV, if needed. # This only works for runners by sudo users. Don't run it if ddev is already installed. From c5f53b15749724bb10958c3df4f3f8e99658e1d2 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Sun, 28 Sep 2025 12:22:12 -0400 Subject: [PATCH 052/138] Fix URL. --- .github/workflows/site.preview.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/site.preview.yml b/.github/workflows/site.preview.yml index e9164cf..59f41d6 100644 --- a/.github/workflows/site.preview.yml +++ b/.github/workflows/site.preview.yml @@ -69,6 +69,7 @@ jobs: ddev_config: | additional_fqdns: - admin.pr${{ github.event.number }}.sites.thinkdrop.net + - ddev-runner.ddev.site test-site: name: Run tests @@ -77,7 +78,7 @@ jobs: steps: - name: Check homepage for Hello World. run: | - curl -s https://github-runner.ddev.site - curl -s https://github-runner.ddev.site | grep "Hello World!" + curl -s https://ddev-runner.ddev.site + curl -s https://ddev-runner.ddev.site | grep "Hello World!" # Not writing ddev config yet. # curl -s http://pr${{ github.event.number }}.sites.thinkdrop.net \ No newline at end of file From f5dec47b2abb45a9681849e3caf55177b8db8c11 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Thu, 2 Oct 2025 18:43:20 -0400 Subject: [PATCH 053/138] Rename. --- .../{ddev.site.deploy.yml => ops.site.deploy.ddev.yml} | 7 ++----- .github/workflows/site.preview.yml | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) rename .github/workflows/{ddev.site.deploy.yml => ops.site.deploy.ddev.yml} (98%) diff --git a/.github/workflows/ddev.site.deploy.yml b/.github/workflows/ops.site.deploy.ddev.yml similarity index 98% rename from .github/workflows/ddev.site.deploy.yml rename to .github/workflows/ops.site.deploy.ddev.yml index 962e2c6..71ed6c7 100644 --- a/.github/workflows/ddev.site.deploy.yml +++ b/.github/workflows/ops.site.deploy.ddev.yml @@ -1,9 +1,6 @@ # -# DDEV Site Deploy -# -# This reusable workflow clones and launches your DDEV projects. -# -# +# Site Deploy +# via DDEV. # on: workflow_call: diff --git a/.github/workflows/site.preview.yml b/.github/workflows/site.preview.yml index 59f41d6..948661d 100644 --- a/.github/workflows/site.preview.yml +++ b/.github/workflows/site.preview.yml @@ -36,7 +36,7 @@ jobs: create-site: name: Create Preview Site - uses: operations-project/github-action-ddev-runner/.github/workflows/ddev.site.deploy.yml@feature/reusable-workflows + uses: operations-project/github-action-ddev-runner/.github/workflows/ops.site.deploy.ddev.yml@feature/reusable-workflows with: # Configure your site here. From 0f75b87221c29db60ebf4a68eb8ed5f0aa041880 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 3 Oct 2025 21:46:58 -0400 Subject: [PATCH 054/138] Update ops.site.deploy.ddev.yml to use run-with-summary. --- .github/workflows/ops.site.deploy.ddev.yml | 42 ++++++++++------------ 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ops.site.deploy.ddev.yml b/.github/workflows/ops.site.deploy.ddev.yml index 71ed6c7..9c6f54d 100644 --- a/.github/workflows/ops.site.deploy.ddev.yml +++ b/.github/workflows/ops.site.deploy.ddev.yml @@ -92,27 +92,7 @@ jobs: runs-on: ${{ inputs.github_runs_on }} steps: - - name: Hello world - run: | - echo "-----------------------------" - echo "Hello world!" - echo "-----------------------------" - echo "Who am I: $(whoami)" - echo "Hostname: $(hostname -f)" - echo "-----------------------------" - echo "Path: ${{ inputs.git_root }}" - echo "Git Reference: ${{ inputs.git_reference }}" - echo "Git Repository: ${{ inputs.git_repository }}" - echo "Sync Command: ${{ inputs.sync_command }}" - echo "Deploy Command: ${{ inputs.deploy_command }}" - echo "-----------------------------" - - echo "DDEV Config:" - echo "${{ inputs.ddev_config }}" - echo "Project Name: ${{ inputs.ddev_project_name }}" - echo "Project TLD: ${{ inputs.ddev_project_tld }}" - echo "-----------------------------" - + - name: Clone code run: | if [[ ! -d ${{ inputs.git_root }} ]]; then @@ -168,11 +148,19 @@ jobs: with: autostart: false + - uses: actions/checkout@v4 + with: + repository: 'jonpugh/goatscripts' + ref: 'v1.0.0' + path: .scripts + - name: Start site working-directory: ${{ inputs.git_root }} if: ${{ inputs.run_start_command }} + env: + HEADER: Started DDEV Site run: | - ${{ inputs.start_command }} + .scripts/src/run-with-summary ${{ inputs.start_command }} # Import, sync, install, etc. prepare-data: @@ -187,14 +175,20 @@ jobs: steps: + - uses: actions/checkout@v4 + with: + repository: 'jonpugh/goatscripts' + ref: 'v1.0.0' + path: .scripts + - name: Prepare data working-directory: ${{ inputs.git_root }} if: ${{ inputs.run_prepare_command }} run: | - ${{ inputs.prepare_command }} + .scripts/src/run-with-summary ${{ inputs.prepare_command }} - name: Deploy command working-directory: ${{ inputs.git_root }} if: ${{ inputs.run_deploy_command }} run: | - ${{ inputs.deploy_command }} + .scripts/src/run-with-summary ${{ inputs.deploy_command }} From d39a48b991498c0818c27038ab894079661c268b Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 3 Oct 2025 22:12:28 -0400 Subject: [PATCH 055/138] Update ops.site.deploy.ddev.yml --- .github/workflows/ops.site.deploy.ddev.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ops.site.deploy.ddev.yml b/.github/workflows/ops.site.deploy.ddev.yml index 9c6f54d..4b67d55 100644 --- a/.github/workflows/ops.site.deploy.ddev.yml +++ b/.github/workflows/ops.site.deploy.ddev.yml @@ -176,6 +176,7 @@ jobs: steps: - uses: actions/checkout@v4 + name: Install scripts with: repository: 'jonpugh/goatscripts' ref: 'v1.0.0' From 98cd83a448243ae6b948b84ea185987661ac3e00 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 3 Oct 2025 22:16:16 -0400 Subject: [PATCH 056/138] Use right version --- .github/workflows/site.preview.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/site.preview.yml b/.github/workflows/site.preview.yml index 948661d..54d5820 100644 --- a/.github/workflows/site.preview.yml +++ b/.github/workflows/site.preview.yml @@ -36,7 +36,7 @@ jobs: create-site: name: Create Preview Site - uses: operations-project/github-action-ddev-runner/.github/workflows/ops.site.deploy.ddev.yml@feature/reusable-workflows + uses: operations-project/github-action-ddev-runner/.github/workflows/ops.site.deploy.ddev.yml@feature/run-with-summary with: # Configure your site here. @@ -81,4 +81,4 @@ jobs: curl -s https://ddev-runner.ddev.site curl -s https://ddev-runner.ddev.site | grep "Hello World!" # Not writing ddev config yet. -# curl -s http://pr${{ github.event.number }}.sites.thinkdrop.net \ No newline at end of file +# curl -s http://pr${{ github.event.number }}.sites.thinkdrop.net From b9b0ac8bb8567afd411befe183617de9a6eec3d8 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 3 Oct 2025 22:19:50 -0400 Subject: [PATCH 057/138] Update ops.site.deploy.ddev.yml --- .github/workflows/ops.site.deploy.ddev.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ops.site.deploy.ddev.yml b/.github/workflows/ops.site.deploy.ddev.yml index 4b67d55..71e73d5 100644 --- a/.github/workflows/ops.site.deploy.ddev.yml +++ b/.github/workflows/ops.site.deploy.ddev.yml @@ -160,6 +160,7 @@ jobs: env: HEADER: Started DDEV Site run: | + ls -la .scripts/src/run-with-summary ${{ inputs.start_command }} # Import, sync, install, etc. From c7c9fa6b931050652048fe4744cd6cc8127181f7 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 3 Oct 2025 22:23:25 -0400 Subject: [PATCH 058/138] Update ops.site.deploy.ddev.yml --- .github/workflows/ops.site.deploy.ddev.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ops.site.deploy.ddev.yml b/.github/workflows/ops.site.deploy.ddev.yml index 71e73d5..9032958 100644 --- a/.github/workflows/ops.site.deploy.ddev.yml +++ b/.github/workflows/ops.site.deploy.ddev.yml @@ -181,13 +181,14 @@ jobs: with: repository: 'jonpugh/goatscripts' ref: 'v1.0.0' - path: .scripts - name: Prepare data working-directory: ${{ inputs.git_root }} if: ${{ inputs.run_prepare_command }} run: | - .scripts/src/run-with-summary ${{ inputs.prepare_command }} + cd ../../github-action-ddev-runner/github-action-ddev-runner/src + ls -la + ./run-with-summary ${{ inputs.prepare_command }} - name: Deploy command working-directory: ${{ inputs.git_root }} From 022b59d0d008f4db44e3748fc8ef96d996989dda Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 3 Oct 2025 22:30:49 -0400 Subject: [PATCH 059/138] Update ops.site.deploy.ddev.yml --- .github/workflows/ops.site.deploy.ddev.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ops.site.deploy.ddev.yml b/.github/workflows/ops.site.deploy.ddev.yml index 9032958..dcb9b71 100644 --- a/.github/workflows/ops.site.deploy.ddev.yml +++ b/.github/workflows/ops.site.deploy.ddev.yml @@ -174,6 +174,9 @@ jobs: name: ${{ inputs.github_environment_name }} url: "${{ inputs.github_environment_url }}" + env: + PATH: ${{ env.GITHUB_WORKSPACE }}/goatscripts/src:/usr/local/bin:/usr/bin:/bin + steps: - uses: actions/checkout@v4 @@ -181,12 +184,12 @@ jobs: with: repository: 'jonpugh/goatscripts' ref: 'v1.0.0' + path: goatscripts - name: Prepare data working-directory: ${{ inputs.git_root }} if: ${{ inputs.run_prepare_command }} run: | - cd ../../github-action-ddev-runner/github-action-ddev-runner/src ls -la ./run-with-summary ${{ inputs.prepare_command }} From 066c9dd1b7fbcbb977b756afdc73822122f5db67 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 3 Oct 2025 22:31:52 -0400 Subject: [PATCH 060/138] Update ops.site.deploy.ddev.yml --- .github/workflows/ops.site.deploy.ddev.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ops.site.deploy.ddev.yml b/.github/workflows/ops.site.deploy.ddev.yml index dcb9b71..f092acf 100644 --- a/.github/workflows/ops.site.deploy.ddev.yml +++ b/.github/workflows/ops.site.deploy.ddev.yml @@ -86,6 +86,9 @@ on: default: ${{ inputs.ddev_project_name }}.${{ inputs.ddev_project_tld }} description: The URL to use for the GitHub environment. +env: + PATH: ${{ env.GITHUB_WORKSPACE }}/goatscripts/src:/usr/local/bin:/usr/bin:/bin + jobs: deploy-code: name: Deploy Code @@ -174,9 +177,6 @@ jobs: name: ${{ inputs.github_environment_name }} url: "${{ inputs.github_environment_url }}" - env: - PATH: ${{ env.GITHUB_WORKSPACE }}/goatscripts/src:/usr/local/bin:/usr/bin:/bin - steps: - uses: actions/checkout@v4 From ed0faa239a906729babbacf0efca3d82c52eb955 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Sat, 4 Oct 2025 10:58:12 -0400 Subject: [PATCH 061/138] Update ops.site.deploy.ddev.yml --- .github/workflows/ops.site.deploy.ddev.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ops.site.deploy.ddev.yml b/.github/workflows/ops.site.deploy.ddev.yml index f092acf..d5cd693 100644 --- a/.github/workflows/ops.site.deploy.ddev.yml +++ b/.github/workflows/ops.site.deploy.ddev.yml @@ -98,6 +98,7 @@ jobs: - name: Clone code run: | + echo $PATH if [[ ! -d ${{ inputs.git_root }} ]]; then git clone ${{ inputs.git_repository }} ${{ inputs.git_root }} fi From a5c791d360e861df00ca5f4b338a638e4ec14535 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Wed, 8 Oct 2025 10:07:38 -0400 Subject: [PATCH 062/138] Fix usage of goatscripts run-with-summary. --- .github/workflows/ops.site.deploy.ddev.yml | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ops.site.deploy.ddev.yml b/.github/workflows/ops.site.deploy.ddev.yml index d5cd693..4d7969e 100644 --- a/.github/workflows/ops.site.deploy.ddev.yml +++ b/.github/workflows/ops.site.deploy.ddev.yml @@ -87,7 +87,7 @@ on: description: The URL to use for the GitHub environment. env: - PATH: ${{ env.GITHUB_WORKSPACE }}/goatscripts/src:/usr/local/bin:/usr/bin:/bin + PATH: ./goatscripts/src:/usr/local/bin:/usr/bin:/bin jobs: deploy-code: @@ -155,17 +155,17 @@ jobs: - uses: actions/checkout@v4 with: repository: 'jonpugh/goatscripts' - ref: 'v1.0.0' - path: .scripts + ref: 'main' + path: goatscripts - name: Start site working-directory: ${{ inputs.git_root }} if: ${{ inputs.run_start_command }} env: - HEADER: Started DDEV Site + SUCCESS: Started DDEV Site :rocket: + ERROR: DDEV start failed :x: run: | - ls -la - .scripts/src/run-with-summary ${{ inputs.start_command }} + run-with-summary ${{ inputs.start_command }} # Import, sync, install, etc. prepare-data: @@ -184,18 +184,17 @@ jobs: name: Install scripts with: repository: 'jonpugh/goatscripts' - ref: 'v1.0.0' + ref: 'main' path: goatscripts - name: Prepare data working-directory: ${{ inputs.git_root }} if: ${{ inputs.run_prepare_command }} run: | - ls -la - ./run-with-summary ${{ inputs.prepare_command }} + run-with-summary ${{ inputs.prepare_command }} - name: Deploy command working-directory: ${{ inputs.git_root }} if: ${{ inputs.run_deploy_command }} run: | - .scripts/src/run-with-summary ${{ inputs.deploy_command }} + run-with-summary ${{ inputs.deploy_command }} From 2f4907d8aeb72d6a438bea36bb69d091ffbb0733 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Wed, 8 Oct 2025 10:09:23 -0400 Subject: [PATCH 063/138] Set message. --- .github/workflows/ops.site.deploy.ddev.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ops.site.deploy.ddev.yml b/.github/workflows/ops.site.deploy.ddev.yml index 4d7969e..ef9bf43 100644 --- a/.github/workflows/ops.site.deploy.ddev.yml +++ b/.github/workflows/ops.site.deploy.ddev.yml @@ -162,8 +162,8 @@ jobs: working-directory: ${{ inputs.git_root }} if: ${{ inputs.run_start_command }} env: - SUCCESS: Started DDEV Site :rocket: - ERROR: DDEV start failed :x: + SUCCESS: "Started DDEV Site :rocket:" + ERROR: "DDEV start failed :x:" run: | run-with-summary ${{ inputs.start_command }} @@ -190,11 +190,17 @@ jobs: - name: Prepare data working-directory: ${{ inputs.git_root }} if: ${{ inputs.run_prepare_command }} + env: + SUCCESS: "Site data preparation successful :rocket:" + ERROR: "Site data preparation failed :x:" run: | run-with-summary ${{ inputs.prepare_command }} - name: Deploy command working-directory: ${{ inputs.git_root }} if: ${{ inputs.run_deploy_command }} + env: + SUCCESS: "Deploy successful :rocket:" + ERROR: "Deploy failed :x:" run: | run-with-summary ${{ inputs.deploy_command }} From 30686572ff2c935d0b04977752e6caf67c6b0385 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Wed, 8 Oct 2025 10:13:36 -0400 Subject: [PATCH 064/138] Fix path. --- .github/workflows/ops.site.deploy.ddev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ops.site.deploy.ddev.yml b/.github/workflows/ops.site.deploy.ddev.yml index ef9bf43..15aad9b 100644 --- a/.github/workflows/ops.site.deploy.ddev.yml +++ b/.github/workflows/ops.site.deploy.ddev.yml @@ -87,7 +87,7 @@ on: description: The URL to use for the GitHub environment. env: - PATH: ./goatscripts/src:/usr/local/bin:/usr/bin:/bin + PATH: ${{ env.GITHUB_WORKSPACE }}/goatscripts/src:/usr/local/bin:/usr/bin:/bin jobs: deploy-code: From 952de53584c5a9371069294ab22345d72adf029a Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Wed, 8 Oct 2025 10:15:30 -0400 Subject: [PATCH 065/138] Set path. --- .github/workflows/ops.site.deploy.ddev.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/ops.site.deploy.ddev.yml b/.github/workflows/ops.site.deploy.ddev.yml index 15aad9b..c7705c3 100644 --- a/.github/workflows/ops.site.deploy.ddev.yml +++ b/.github/workflows/ops.site.deploy.ddev.yml @@ -86,9 +86,6 @@ on: default: ${{ inputs.ddev_project_name }}.${{ inputs.ddev_project_tld }} description: The URL to use for the GitHub environment. -env: - PATH: ${{ env.GITHUB_WORKSPACE }}/goatscripts/src:/usr/local/bin:/usr/bin:/bin - jobs: deploy-code: name: Deploy Code @@ -143,6 +140,7 @@ jobs: echo "name: ${{ inputs.ddev_project_name }}" >> ${{ inputs.ddev_config_filename }} echo "project_tld: ${{ inputs.ddev_project_tld }}" >> ${{ inputs.ddev_config_filename }} echo "${{ inputs.ddev_config }}" >> ${{ inputs.ddev_config_filename }} + echo "$GITHUB_WORKSPACE/goatscripts/src" >> $GITHUB_PATH # Install DDEV, if needed. # This only works for runners by sudo users. Don't run it if ddev is already installed. From 895c55aeb7623ebfb2734002f90d15d5d38e0265 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Wed, 8 Oct 2025 10:18:14 -0400 Subject: [PATCH 066/138] Try to use run-with-summary when launching server. --- .github/workflows/site.preview.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/site.preview.yml b/.github/workflows/site.preview.yml index 54d5820..9e188ab 100644 --- a/.github/workflows/site.preview.yml +++ b/.github/workflows/site.preview.yml @@ -22,11 +22,17 @@ jobs: repository: 'operations-project/github-runner-starter' ref: 'v1.2.1' + - uses: actions/checkout@v4 + with: + repository: 'jonpugh/goatscripts' + ref: 'main' + path: goatscripts + # Kick off the runner script over and over until there are no more queued jobs. - name: "Launch runner script." run: | while [[ $(curl -s -H "Authorization: token ${GITHUB_TOKEN}" "https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/jobs" | jq -r '.jobs[] | select(.status=="queued") | .id' | wc -l) -gt 0 ]]; do - ./github-runner-starter \ + ./goatscripts/src/run-with-summary ./github-runner-starter \ --run \ --name=github.actions.runner.${{ github.run_id }}.${{ matrix.runner }} \ --labels=github.actions.runner.${{ github.run_id }} \ From 9e6d98ce39407e25bdb76e1e1e46d664ad72b664 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Wed, 8 Oct 2025 10:19:30 -0400 Subject: [PATCH 067/138] Set path to allow commands. --- .github/workflows/ops.site.deploy.ddev.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ops.site.deploy.ddev.yml b/.github/workflows/ops.site.deploy.ddev.yml index c7705c3..140cd20 100644 --- a/.github/workflows/ops.site.deploy.ddev.yml +++ b/.github/workflows/ops.site.deploy.ddev.yml @@ -192,6 +192,7 @@ jobs: SUCCESS: "Site data preparation successful :rocket:" ERROR: "Site data preparation failed :x:" run: | + echo "$GITHUB_WORKSPACE/goatscripts/src" >> $GITHUB_PATH run-with-summary ${{ inputs.prepare_command }} - name: Deploy command From 0bec64bb4ed325c481a42ced18e3af6a621b02d5 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Wed, 8 Oct 2025 10:28:23 -0400 Subject: [PATCH 068/138] Set PATH at the top. --- .github/workflows/ops.site.deploy.ddev.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ops.site.deploy.ddev.yml b/.github/workflows/ops.site.deploy.ddev.yml index 140cd20..6422ac6 100644 --- a/.github/workflows/ops.site.deploy.ddev.yml +++ b/.github/workflows/ops.site.deploy.ddev.yml @@ -86,6 +86,9 @@ on: default: ${{ inputs.ddev_project_name }}.${{ inputs.ddev_project_tld }} description: The URL to use for the GitHub environment. +env: + PATH: "./goatscripts/src:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin" + jobs: deploy-code: name: Deploy Code @@ -192,7 +195,6 @@ jobs: SUCCESS: "Site data preparation successful :rocket:" ERROR: "Site data preparation failed :x:" run: | - echo "$GITHUB_WORKSPACE/goatscripts/src" >> $GITHUB_PATH run-with-summary ${{ inputs.prepare_command }} - name: Deploy command From 29cd587f85934c78f58da8f2e07320a1d6d9857d Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Wed, 8 Oct 2025 12:41:33 -0400 Subject: [PATCH 069/138] make identical, --- .github/workflows/ops.site.deploy.ddev.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ops.site.deploy.ddev.yml b/.github/workflows/ops.site.deploy.ddev.yml index 6422ac6..840fa07 100644 --- a/.github/workflows/ops.site.deploy.ddev.yml +++ b/.github/workflows/ops.site.deploy.ddev.yml @@ -182,12 +182,11 @@ jobs: steps: - uses: actions/checkout@v4 - name: Install scripts with: repository: 'jonpugh/goatscripts' ref: 'main' path: goatscripts - + - name: Prepare data working-directory: ${{ inputs.git_root }} if: ${{ inputs.run_prepare_command }} From 66d7efc3dc72468719063a6b4aafef109b63e014 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Wed, 8 Oct 2025 12:42:41 -0400 Subject: [PATCH 070/138] Add goatscripts to path. --- .github/workflows/ops.site.deploy.ddev.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ops.site.deploy.ddev.yml b/.github/workflows/ops.site.deploy.ddev.yml index 840fa07..58cbff9 100644 --- a/.github/workflows/ops.site.deploy.ddev.yml +++ b/.github/workflows/ops.site.deploy.ddev.yml @@ -86,9 +86,6 @@ on: default: ${{ inputs.ddev_project_name }}.${{ inputs.ddev_project_tld }} description: The URL to use for the GitHub environment. -env: - PATH: "./goatscripts/src:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin" - jobs: deploy-code: name: Deploy Code @@ -187,6 +184,10 @@ jobs: ref: 'main' path: goatscripts + - name: Set environment + run: | + echo "$GITHUB_WORKSPACE/goatscripts/src" >> $GITHUB_PATH + - name: Prepare data working-directory: ${{ inputs.git_root }} if: ${{ inputs.run_prepare_command }} From f8325cfb5570ac8e4b3eeaa0f8d9e9ce2a39e794 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Wed, 8 Oct 2025 12:50:27 -0400 Subject: [PATCH 071/138] Add summary. --- .github/workflows/ops.site.deploy.ddev.yml | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ops.site.deploy.ddev.yml b/.github/workflows/ops.site.deploy.ddev.yml index 58cbff9..57240e3 100644 --- a/.github/workflows/ops.site.deploy.ddev.yml +++ b/.github/workflows/ops.site.deploy.ddev.yml @@ -92,17 +92,29 @@ jobs: runs-on: ${{ inputs.github_runs_on }} steps: - + - name: Clone code + env: + SUCCESS: "Codebase successfully cloned :computer:" + ERROR: "Git clone failed :x:" + SUMMARY: | + - Repository: ${{ inputs.git_repository }} + - Reference: ${{ inputs.git_reference }} + - Root: ${{ inputs.git_root }} + - Environment: ${{ inputs.github_environment_name }} + - URL: ${{ inputs.github_environment_url }} + - Pull Request: ${{ github.event.pull_request.html_url }} + run: | - echo $PATH + PATH=$PATH:$GITHUB_WORKSPACE/goatscripts/src if [[ ! -d ${{ inputs.git_root }} ]]; then - git clone ${{ inputs.git_repository }} ${{ inputs.git_root }} + run-with-summary git clone ${{ inputs.git_repository }} ${{ inputs.git_root }} fi cd ${{ inputs.git_root }} git checkout ${{ inputs.git_reference }} - echo ----------------------------- - echo "Cloned code to ${{ inputs.git_root }}" + + SUCCESS="git status" \ + run-with-summary git status start-site: name: Start site From 042c6bb98832399d5c507e60564a081cb2794e30 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Wed, 8 Oct 2025 12:50:39 -0400 Subject: [PATCH 072/138] Add summary. --- .github/workflows/ops.site.deploy.ddev.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ops.site.deploy.ddev.yml b/.github/workflows/ops.site.deploy.ddev.yml index 57240e3..058b068 100644 --- a/.github/workflows/ops.site.deploy.ddev.yml +++ b/.github/workflows/ops.site.deploy.ddev.yml @@ -114,6 +114,7 @@ jobs: git checkout ${{ inputs.git_reference }} SUCCESS="git status" \ + SUMMARY="" \ run-with-summary git status start-site: From 97bdc9455b7f5555bdc0b235d0fe79513aa39b71 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Wed, 8 Oct 2025 12:51:43 -0400 Subject: [PATCH 073/138] try again? --- .github/workflows/ops.site.deploy.ddev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ops.site.deploy.ddev.yml b/.github/workflows/ops.site.deploy.ddev.yml index 058b068..516d906 100644 --- a/.github/workflows/ops.site.deploy.ddev.yml +++ b/.github/workflows/ops.site.deploy.ddev.yml @@ -106,7 +106,7 @@ jobs: - Pull Request: ${{ github.event.pull_request.html_url }} run: | - PATH=$PATH:$GITHUB_WORKSPACE/goatscripts/src + export PATH=$PATH:$GITHUB_WORKSPACE/goatscripts/src if [[ ! -d ${{ inputs.git_root }} ]]; then run-with-summary git clone ${{ inputs.git_repository }} ${{ inputs.git_root }} fi From d18e6eaa7763c4f7219d19aceb2bb3f1ad8d655b Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Wed, 8 Oct 2025 12:55:06 -0400 Subject: [PATCH 074/138] try again? --- .github/workflows/ops.site.deploy.ddev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ops.site.deploy.ddev.yml b/.github/workflows/ops.site.deploy.ddev.yml index 516d906..15451fb 100644 --- a/.github/workflows/ops.site.deploy.ddev.yml +++ b/.github/workflows/ops.site.deploy.ddev.yml @@ -106,7 +106,7 @@ jobs: - Pull Request: ${{ github.event.pull_request.html_url }} run: | - export PATH=$PATH:$GITHUB_WORKSPACE/goatscripts/src + PATH=$GITHUB_WORKSPACE/goatscripts/src:$PATH if [[ ! -d ${{ inputs.git_root }} ]]; then run-with-summary git clone ${{ inputs.git_repository }} ${{ inputs.git_root }} fi From f178444b8acc61916d0e06fa0c9fafb8228b24f9 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Wed, 8 Oct 2025 12:56:06 -0400 Subject: [PATCH 075/138] try again? --- .github/workflows/ops.site.deploy.ddev.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ops.site.deploy.ddev.yml b/.github/workflows/ops.site.deploy.ddev.yml index 15451fb..922f8d0 100644 --- a/.github/workflows/ops.site.deploy.ddev.yml +++ b/.github/workflows/ops.site.deploy.ddev.yml @@ -106,7 +106,8 @@ jobs: - Pull Request: ${{ github.event.pull_request.html_url }} run: | - PATH=$GITHUB_WORKSPACE/goatscripts/src:$PATH + export PATH=$GITHUB_WORKSPACE/goatscripts/src:$PATH + echo $PATH if [[ ! -d ${{ inputs.git_root }} ]]; then run-with-summary git clone ${{ inputs.git_repository }} ${{ inputs.git_root }} fi From 52c889194d97000eec386a6669f4c4075490e7ed Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Wed, 8 Oct 2025 12:59:12 -0400 Subject: [PATCH 076/138] Forgot to download scripts. --- .github/workflows/ops.site.deploy.ddev.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ops.site.deploy.ddev.yml b/.github/workflows/ops.site.deploy.ddev.yml index 922f8d0..6c56dbd 100644 --- a/.github/workflows/ops.site.deploy.ddev.yml +++ b/.github/workflows/ops.site.deploy.ddev.yml @@ -93,6 +93,12 @@ jobs: steps: + - uses: actions/checkout@v4 + with: + repository: 'jonpugh/goatscripts' + ref: 'main' + path: goatscripts + - name: Clone code env: SUCCESS: "Codebase successfully cloned :computer:" From dd9ef0edb782dcb5cd7686cf8a692fcfb405e088 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Wed, 8 Oct 2025 13:01:10 -0400 Subject: [PATCH 077/138] print git log as well. --- .github/workflows/ops.site.deploy.ddev.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ops.site.deploy.ddev.yml b/.github/workflows/ops.site.deploy.ddev.yml index 6c56dbd..52c47b7 100644 --- a/.github/workflows/ops.site.deploy.ddev.yml +++ b/.github/workflows/ops.site.deploy.ddev.yml @@ -120,9 +120,13 @@ jobs: cd ${{ inputs.git_root }} git checkout ${{ inputs.git_reference }} + SUMMARY="" + SUCCESS="git status" \ - SUMMARY="" \ run-with-summary git status + + SUCCESS="git log" \ + run-with-summary git log -1 start-site: name: Start site From a0c07ef26808b63b996c1448af348b471ee1f287 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Wed, 8 Oct 2025 13:03:39 -0400 Subject: [PATCH 078/138] don't bother with summaries for github runners. --- .github/workflows/site.preview.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/site.preview.yml b/.github/workflows/site.preview.yml index 9e188ab..54d5820 100644 --- a/.github/workflows/site.preview.yml +++ b/.github/workflows/site.preview.yml @@ -22,17 +22,11 @@ jobs: repository: 'operations-project/github-runner-starter' ref: 'v1.2.1' - - uses: actions/checkout@v4 - with: - repository: 'jonpugh/goatscripts' - ref: 'main' - path: goatscripts - # Kick off the runner script over and over until there are no more queued jobs. - name: "Launch runner script." run: | while [[ $(curl -s -H "Authorization: token ${GITHUB_TOKEN}" "https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/jobs" | jq -r '.jobs[] | select(.status=="queued") | .id' | wc -l) -gt 0 ]]; do - ./goatscripts/src/run-with-summary ./github-runner-starter \ + ./github-runner-starter \ --run \ --name=github.actions.runner.${{ github.run_id }}.${{ matrix.runner }} \ --labels=github.actions.runner.${{ github.run_id }} \ From a5974c86bbb0a3b5dabbcb1a1b99a35dff27e63f Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Wed, 8 Oct 2025 13:04:55 -0400 Subject: [PATCH 079/138] Don't cancel in progress site preview deploy runs. --- .github/workflows/site.preview.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/site.preview.yml b/.github/workflows/site.preview.yml index 54d5820..e391d65 100644 --- a/.github/workflows/site.preview.yml +++ b/.github/workflows/site.preview.yml @@ -8,7 +8,7 @@ env: concurrency: group: ${{ github.workflow }}-${{ github.event.number }} - cancel-in-progress: true + cancel-in-progress: false jobs: # This emulates a persistent server. The ddev.site.deploy.yml jobs require one. From 983bf1f40305c1e730806979dec5edfe5099a90d Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Wed, 8 Oct 2025 13:18:25 -0400 Subject: [PATCH 080/138] Use run with summary for tests. --- .github/workflows/site.preview.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/site.preview.yml b/.github/workflows/site.preview.yml index e391d65..c91150d 100644 --- a/.github/workflows/site.preview.yml +++ b/.github/workflows/site.preview.yml @@ -76,9 +76,23 @@ jobs: needs: create-site runs-on: github.actions.runner.${{ github.run_id }} steps: + + - uses: actions/checkout@v4 + with: + repository: 'jonpugh/goatscripts' + ref: 'main' + path: goatscripts + + - name: Set environment + run: | + echo "$GITHUB_WORKSPACE/goatscripts/src" >> $GITHUB_PATH + - name: Check homepage for Hello World. + env: + SUCCESS: "Tests passed! DDEV webserver is online. :confetti:" + ERROR: "Unable to load DDEV website. :x:" run: | - curl -s https://ddev-runner.ddev.site + run-with-summary curl -s https://ddev-runner.ddev.site curl -s https://ddev-runner.ddev.site | grep "Hello World!" # Not writing ddev config yet. # curl -s http://pr${{ github.event.number }}.sites.thinkdrop.net From f8903f664782f868a70db8b17f6ec08b4302a24a Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Wed, 8 Oct 2025 13:24:11 -0400 Subject: [PATCH 081/138] Disable instrumentation. --- .github/workflows/ops.site.deploy.ddev.yml | 17 +++++++++-------- .github/workflows/site.preview.yml | 1 + 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ops.site.deploy.ddev.yml b/.github/workflows/ops.site.deploy.ddev.yml index 52c47b7..3fb18da 100644 --- a/.github/workflows/ops.site.deploy.ddev.yml +++ b/.github/workflows/ops.site.deploy.ddev.yml @@ -157,23 +157,24 @@ jobs: exit 1 fi + # Install DDEV, if needed. + # This only works for runners by sudo users. Don't run it if ddev is already installed. + - name: Setup DDEV + uses: ddev/github-action-setup-ddev@v1 + if: ${{ env.DDEV_INSTALLED == 'false' }} + with: + autostart: false + - name: Configure DDEV working-directory: ${{ inputs.git_root }}/.ddev run: | + ddev config global --instrumentation-opt-in=false echo "# DDEV Config created by GitHub workflow https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" > ${{ inputs.ddev_config_filename }} echo "name: ${{ inputs.ddev_project_name }}" >> ${{ inputs.ddev_config_filename }} echo "project_tld: ${{ inputs.ddev_project_tld }}" >> ${{ inputs.ddev_config_filename }} echo "${{ inputs.ddev_config }}" >> ${{ inputs.ddev_config_filename }} echo "$GITHUB_WORKSPACE/goatscripts/src" >> $GITHUB_PATH - # Install DDEV, if needed. - # This only works for runners by sudo users. Don't run it if ddev is already installed. - - name: Setup DDEV - uses: ddev/github-action-setup-ddev@v1 - if: ${{ env.DDEV_INSTALLED == 'false' }} - with: - autostart: false - - uses: actions/checkout@v4 with: repository: 'jonpugh/goatscripts' diff --git a/.github/workflows/site.preview.yml b/.github/workflows/site.preview.yml index c91150d..675a5f1 100644 --- a/.github/workflows/site.preview.yml +++ b/.github/workflows/site.preview.yml @@ -24,6 +24,7 @@ jobs: # Kick off the runner script over and over until there are no more queued jobs. - name: "Launch runner script." + run: | while [[ $(curl -s -H "Authorization: token ${GITHUB_TOKEN}" "https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/jobs" | jq -r '.jobs[] | select(.status=="queued") | .id' | wc -l) -gt 0 ]]; do ./github-runner-starter \ From eb67e01196cce6715547708b3836d518e7bbfce0 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Wed, 8 Oct 2025 13:33:08 -0400 Subject: [PATCH 082/138] Sleep 4 just to make sure --- .github/workflows/site.preview.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/site.preview.yml b/.github/workflows/site.preview.yml index 675a5f1..c4ff404 100644 --- a/.github/workflows/site.preview.yml +++ b/.github/workflows/site.preview.yml @@ -32,7 +32,7 @@ jobs: --name=github.actions.runner.${{ github.run_id }}.${{ matrix.runner }} \ --labels=github.actions.runner.${{ github.run_id }} \ --config-sh-options=--ephemeral - sleep 3 + sleep 4 done create-site: From 4ceee25334e3253f599e85e91e788a5563363001 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Wed, 8 Oct 2025 13:36:49 -0400 Subject: [PATCH 083/138] Curl --- .github/workflows/site.preview.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/site.preview.yml b/.github/workflows/site.preview.yml index c4ff404..2868f04 100644 --- a/.github/workflows/site.preview.yml +++ b/.github/workflows/site.preview.yml @@ -90,10 +90,10 @@ jobs: - name: Check homepage for Hello World. env: - SUCCESS: "Tests passed! DDEV webserver is online. :confetti:" + SUCCESS: "Tests passed! DDEV webserver is online. :boom:" ERROR: "Unable to load DDEV website. :x:" run: | - run-with-summary curl -s https://ddev-runner.ddev.site + run-with-summary curl https://ddev-runner.ddev.site curl -s https://ddev-runner.ddev.site | grep "Hello World!" # Not writing ddev config yet. # curl -s http://pr${{ github.event.number }}.sites.thinkdrop.net From 5e64ddafb688e39ac313e0df1282fb87c6f05a6f Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Wed, 8 Oct 2025 13:41:56 -0400 Subject: [PATCH 084/138] Use versioned scripts. --- .github/workflows/ops.site.deploy.ddev.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ops.site.deploy.ddev.yml b/.github/workflows/ops.site.deploy.ddev.yml index 3fb18da..e14e506 100644 --- a/.github/workflows/ops.site.deploy.ddev.yml +++ b/.github/workflows/ops.site.deploy.ddev.yml @@ -96,7 +96,7 @@ jobs: - uses: actions/checkout@v4 with: repository: 'jonpugh/goatscripts' - ref: 'main' + ref: 'v1.1.0' path: goatscripts - name: Clone code @@ -178,7 +178,7 @@ jobs: - uses: actions/checkout@v4 with: repository: 'jonpugh/goatscripts' - ref: 'main' + ref: 'v1.1.0' path: goatscripts - name: Start site From 595099d179c451000cb5d06c19b6eb0f54452fbb Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Wed, 8 Oct 2025 16:11:58 -0400 Subject: [PATCH 085/138] Change filename of ddev deploy reusable workflow. --- ...ops.site.deploy.ddev.yml => operations.site.deploy.ddev.yml} | 0 .github/workflows/site.preview.yml | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{ops.site.deploy.ddev.yml => operations.site.deploy.ddev.yml} (100%) diff --git a/.github/workflows/ops.site.deploy.ddev.yml b/.github/workflows/operations.site.deploy.ddev.yml similarity index 100% rename from .github/workflows/ops.site.deploy.ddev.yml rename to .github/workflows/operations.site.deploy.ddev.yml diff --git a/.github/workflows/site.preview.yml b/.github/workflows/site.preview.yml index 948661d..fe77b77 100644 --- a/.github/workflows/site.preview.yml +++ b/.github/workflows/site.preview.yml @@ -36,7 +36,7 @@ jobs: create-site: name: Create Preview Site - uses: operations-project/github-action-ddev-runner/.github/workflows/ops.site.deploy.ddev.yml@feature/reusable-workflows + uses: operations-project/github-action-ddev-runner/.github/workflows/operations.site.deploy.ddev.yml@feature/reusable-workflows with: # Configure your site here. From 5b1cf79e4363eafd51fba4b912753d33294eaaa4 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Wed, 8 Oct 2025 16:14:51 -0400 Subject: [PATCH 086/138] Add comments. --- .github/workflows/operations.site.deploy.ddev.yml | 7 +++++-- .github/workflows/site.preview.yml | 8 ++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/operations.site.deploy.ddev.yml b/.github/workflows/operations.site.deploy.ddev.yml index 71ed6c7..f686405 100644 --- a/.github/workflows/operations.site.deploy.ddev.yml +++ b/.github/workflows/operations.site.deploy.ddev.yml @@ -1,6 +1,9 @@ # -# Site Deploy -# via DDEV. +# Operations Project Workflow: Deploy DDEV Site. +# +# This reusable workflow will deploy a website with DDEV. +# +# See https://github.com/operations-project/site-runner-ddev for more information. # on: workflow_call: diff --git a/.github/workflows/site.preview.yml b/.github/workflows/site.preview.yml index fe77b77..76ba433 100644 --- a/.github/workflows/site.preview.yml +++ b/.github/workflows/site.preview.yml @@ -1,3 +1,11 @@ +# +# Operations Project Workflow: Example Pull Request Site workflow. +# +# This example workflow uses the reusable workflow operations.site.deploy.ddev.yml. +# You can copy this into your project. +# +# See https://github.com/operations-project/site-runner-ddev for more information. +# name: Preview Sites on: pull_request: From fc719a909bcde4c9dfa2654dbf47ada6dd03df81 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Wed, 8 Oct 2025 16:57:34 -0400 Subject: [PATCH 087/138] Is this secret needed?? --- .../workflows/{site.preview.yml => example.site.preview.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{site.preview.yml => example.site.preview.yml} (98%) diff --git a/.github/workflows/site.preview.yml b/.github/workflows/example.site.preview.yml similarity index 98% rename from .github/workflows/site.preview.yml rename to .github/workflows/example.site.preview.yml index 76ba433..f58a3ba 100644 --- a/.github/workflows/site.preview.yml +++ b/.github/workflows/example.site.preview.yml @@ -12,7 +12,7 @@ on: env: # https://github.com/operations-project/github-runner-starter/settings/secrets/actions/JONPUGH_GITHUB_TOKEN_ADMIN - GITHUB_TOKEN: "${{ secrets.OPERATIONS_GITHUB_TOKEN_ADMIN }}" +# GITHUB_TOKEN: "${{ secrets.OPERATIONS_GITHUB_TOKEN_ADMIN }}" concurrency: group: ${{ github.workflow }}-${{ github.event.number }} From 655e77d38c7f43ad3ea3e4dd4ba76d2cf208ceda Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Wed, 8 Oct 2025 17:01:08 -0400 Subject: [PATCH 088/138] Comments on the GITHUB_TOKEN substitution. --- .github/workflows/example.site.preview.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/example.site.preview.yml b/.github/workflows/example.site.preview.yml index f58a3ba..bfec979 100644 --- a/.github/workflows/example.site.preview.yml +++ b/.github/workflows/example.site.preview.yml @@ -11,8 +11,10 @@ on: pull_request: env: - # https://github.com/operations-project/github-runner-starter/settings/secrets/actions/JONPUGH_GITHUB_TOKEN_ADMIN -# GITHUB_TOKEN: "${{ secrets.OPERATIONS_GITHUB_TOKEN_ADMIN }}" + # This example creates github runners for each subsequent job. + # To do so, it needs a GitHub token with admin:write permissions. + # Create a personal access token with admin:write permissions on the repository you wish to deploy. + GITHUB_TOKEN: "${{ secrets.OPERATIONS_GITHUB_TOKEN_ADMIN }}" concurrency: group: ${{ github.workflow }}-${{ github.event.number }} From f7ded91b26c0febdf5431d6c1d8839404bb6ca0f Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 10 Oct 2025 08:05:16 -0400 Subject: [PATCH 089/138] Add delete site workflow. --- .github/workflows/example.site.preview.yml | 6 ++ .../workflows/operations.site.deploy.ddev.yml | 3 +- .../operations.site.destroy.ddev.yml | 75 +++++++++++++++++++ 3 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/operations.site.destroy.ddev.yml diff --git a/.github/workflows/example.site.preview.yml b/.github/workflows/example.site.preview.yml index 9113f52..e6cc7f0 100644 --- a/.github/workflows/example.site.preview.yml +++ b/.github/workflows/example.site.preview.yml @@ -107,3 +107,9 @@ jobs: curl -s https://ddev-runner.ddev.site | grep "Hello World!" # Not writing ddev config yet. # curl -s http://pr${{ github.event.number }}.sites.thinkdrop.net + + remove-site: + name: Remove Site + uses: operations-project/github-action-ddev-runner/.github/workflows/operations.site.destroy.ddev.yml@feature/reusable-workflows + with: + git_root: /home/runner/ourproject/pr${{ github.event.number }} \ No newline at end of file diff --git a/.github/workflows/operations.site.deploy.ddev.yml b/.github/workflows/operations.site.deploy.ddev.yml index 7888efe..e177be3 100644 --- a/.github/workflows/operations.site.deploy.ddev.yml +++ b/.github/workflows/operations.site.deploy.ddev.yml @@ -3,8 +3,9 @@ # # This reusable workflow will deploy a website with DDEV. # -# See https://github.com/operations-project/site-runner-ddev for more information. +# See https://github.com/operations-project/github-action-ddev-runner for more information. # +name: Deploy site on: workflow_call: inputs: diff --git a/.github/workflows/operations.site.destroy.ddev.yml b/.github/workflows/operations.site.destroy.ddev.yml new file mode 100644 index 0000000..c8f081b --- /dev/null +++ b/.github/workflows/operations.site.destroy.ddev.yml @@ -0,0 +1,75 @@ +# +# Operations Project Workflow: Destroy DDEV Site. +# +# This reusable workflow will DESTROY a DDEV hosted website. +# +# See https://github.com/operations-project/github-action-ddev-runner for more information. +# +name: Destroy site +on: + workflow_call: + inputs: + + git_root: + required: true + type: string + description: The path to the existing DDEV site. + + destroy_command: + default: ddev remove --remove-data --omit-snapshot + type: string + description: The command to destroy the site and codebase. + + remove_code: + default: true + type: boolean + description: Whether to remove the codebase. + + github_runs_on: + type: string + default: ubuntu-latest + description: The label of the runner you wish to use. + +jobs: + destroy-site: + name: Destroy site + runs-on: ${{ inputs.github_runs_on }} + steps: + + - uses: actions/checkout@v4 + with: + repository: 'jonpugh/goatscripts' + ref: 'main' + path: goatscripts + + - name: Set environment + run: echo "$GITHUB_WORKSPACE/goatscripts/src" >> $GITHUB_PATH + + - name: Destroy site + working-directory: ${{ inputs.git_root }} + env: + SUCCESS: "DDEV site removed :check_mark:" + ERROR: "Unable to remove DDEV site :x:" + run: | + run-with-summary ${{ inputs.destroy_command }} + + destroy-code: + name: Destroy Code + runs-on: ${{ inputs.github_runs_on }} + needs: destroy-site + steps: + - uses: actions/checkout@v4 + with: + repository: 'jonpugh/goatscripts' + ref: 'v1.1.0' + path: goatscripts + + - name: Remove code + env: + SUCCESS: "Codebase removed :check_mark:" + ERROR: "Unable to remove codebase :x:" + SUMMARY: | + - Root: ${{ inputs.git_root }} + run: | + run-with-summary rm -rf ${{ inputs.git_root }} + From 180ff4637ecc8044736e39062cc4be3f2d8c0e64 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 10 Oct 2025 08:07:28 -0400 Subject: [PATCH 090/138] Don't run until test site is done. --- .github/workflows/example.site.preview.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/example.site.preview.yml b/.github/workflows/example.site.preview.yml index e6cc7f0..b5302b9 100644 --- a/.github/workflows/example.site.preview.yml +++ b/.github/workflows/example.site.preview.yml @@ -111,5 +111,6 @@ jobs: remove-site: name: Remove Site uses: operations-project/github-action-ddev-runner/.github/workflows/operations.site.destroy.ddev.yml@feature/reusable-workflows + needs: test-site with: git_root: /home/runner/ourproject/pr${{ github.event.number }} \ No newline at end of file From 9e4388644a671a4621957781b20562f55461a9e0 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 10 Oct 2025 08:15:47 -0400 Subject: [PATCH 091/138] debug --- .github/workflows/operations.site.destroy.ddev.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/operations.site.destroy.ddev.yml b/.github/workflows/operations.site.destroy.ddev.yml index c8f081b..08d01df 100644 --- a/.github/workflows/operations.site.destroy.ddev.yml +++ b/.github/workflows/operations.site.destroy.ddev.yml @@ -43,7 +43,10 @@ jobs: path: goatscripts - name: Set environment - run: echo "$GITHUB_WORKSPACE/goatscripts/src" >> $GITHUB_PATH + run: | + echo "$GITHUB_WORKSPACE/goatscripts/src" >> $GITHUB_PATH + echo ${{ inputs.git_root }} + ls -la ${{ inputs.git_root }} - name: Destroy site working-directory: ${{ inputs.git_root }} From a5edff8118b895d5da72b5d3626ef61c7be27aac Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 10 Oct 2025 08:19:50 -0400 Subject: [PATCH 092/138] Wrong runs-on. --- .github/workflows/example.site.preview.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/example.site.preview.yml b/.github/workflows/example.site.preview.yml index b5302b9..2820c5c 100644 --- a/.github/workflows/example.site.preview.yml +++ b/.github/workflows/example.site.preview.yml @@ -113,4 +113,5 @@ jobs: uses: operations-project/github-action-ddev-runner/.github/workflows/operations.site.destroy.ddev.yml@feature/reusable-workflows needs: test-site with: - git_root: /home/runner/ourproject/pr${{ github.event.number }} \ No newline at end of file + git_root: /home/runner/ourproject/pr${{ github.event.number }} + github_runs_on: github.actions.runner.${{ github.run_id }} From df9f0864a1642d309ed673a2b67a8a612ec299b9 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 10 Oct 2025 08:24:07 -0400 Subject: [PATCH 093/138] Set env. --- .github/workflows/operations.site.destroy.ddev.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/operations.site.destroy.ddev.yml b/.github/workflows/operations.site.destroy.ddev.yml index 08d01df..683356f 100644 --- a/.github/workflows/operations.site.destroy.ddev.yml +++ b/.github/workflows/operations.site.destroy.ddev.yml @@ -39,7 +39,7 @@ jobs: - uses: actions/checkout@v4 with: repository: 'jonpugh/goatscripts' - ref: 'main' + ref: 'v1.1.0' path: goatscripts - name: Set environment @@ -67,6 +67,9 @@ jobs: ref: 'v1.1.0' path: goatscripts + - name: Set environment + run: echo "$GITHUB_WORKSPACE/goatscripts/src" >> $GITHUB_PATH + - name: Remove code env: SUCCESS: "Codebase removed :check_mark:" From e1073280e64e6bbc8ef9780c97c59e9d1ab51c12 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 10 Oct 2025 08:40:05 -0400 Subject: [PATCH 094/138] no need to sleep? --- .github/workflows/example.site.preview.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/example.site.preview.yml b/.github/workflows/example.site.preview.yml index 2820c5c..0a82479 100644 --- a/.github/workflows/example.site.preview.yml +++ b/.github/workflows/example.site.preview.yml @@ -42,7 +42,6 @@ jobs: --name=github.actions.runner.${{ github.run_id }}.${{ matrix.runner }} \ --labels=github.actions.runner.${{ github.run_id }} \ --config-sh-options=--ephemeral - sleep 4 done create-site: From 6b7c2f07628130cff8a4ee99b3ee61992b2f5bb3 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 10 Oct 2025 08:42:50 -0400 Subject: [PATCH 095/138] sleep 3 --- .github/workflows/example.site.preview.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/example.site.preview.yml b/.github/workflows/example.site.preview.yml index 0a82479..25618a0 100644 --- a/.github/workflows/example.site.preview.yml +++ b/.github/workflows/example.site.preview.yml @@ -42,6 +42,7 @@ jobs: --name=github.actions.runner.${{ github.run_id }}.${{ matrix.runner }} \ --labels=github.actions.runner.${{ github.run_id }} \ --config-sh-options=--ephemeral + sleep 3 done create-site: From 1bf364cf119dab9bca6700992ddee476fa9615c0 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Thu, 30 Oct 2025 07:23:01 -0400 Subject: [PATCH 096/138] Revise README for DDEV Hosting GitHub Actions Updated README to reflect new GitHub Actions workflows and usage instructions. --- README.md | 81 +++++++++++++++++-------------------------------------- 1 file changed, 25 insertions(+), 56 deletions(-) diff --git a/README.md b/README.md index 4bdb238..09a1866 100644 --- a/README.md +++ b/README.md @@ -1,75 +1,44 @@ -# DDEV GitHub Actions Runner +# DDEV Hosting Reusable GitHub Actions +## Self-hosted automation for ddev projects -This GitHub Action is designed to host real live sites using self-hosted GitHub runners and DDEV. +These reusable GitHub Workflows allow you to automate the deployment and testing of DDEV sites on your own servers. -DDEV is a tool for launching multiple sites on a single server using Docker. +Useful for hosting and CI/CD servers. -This action makes it easy to clone a site and launch `ddev start`. +## Reusable Workflows -For more detailed documentation and usage examples, see https://operations-project.gitbook.io/operations-experience-project/operations-site-server. +Include these workflows inside your own github workflow files: -Notes ------ - -This action does NOT install `ddev`. +- [`operations.site.deploy.yml`](./.github/workflows/operations.site.deploy.ddev.yml) + - **Deploy Code:** git clone and checkout desired branch to desired path. + - **Start Site:** Write special DDEV configs and run `ddev start` to launch the site. + - **Import Site:** Run your own sync command to import or install your site. +- [`operations.site.destroy.yml`](./.github/workflows/operations.site.destroy.ddev.yml) + - **Remove Site**: `ddev rm -OR` + - **Remove Code**: `rm -rf $DIR` +- More workflows TBD. -If using on a self-hosted runner, make sure you install ddev first. +## Server Setup -If running in CI, you can install DDEV in github workflows with this action: https://github.com/Lullabot/drainpipe/blob/main/scaffold/github/actions/common/ddev/action.yml +To prepare a server for running these workflows, you can use the [Operations Site Runner]([url](https://github.com/operations-project/ansible-collection-site-runner)) Ansible collection. see https://github.com/operations-project/ansible-collection-site-runner. -Operations Site Runner ----------------------- +The main components: -You can prepare a server for running sites using the Operations Site Runner tool: https://github.com/operations-project/site-runner/ - -It will prepare server users, install DDEV, and setup GitHub Runners as a service. +- Sysadmin users from GitHub accounts. +- Platform user for running sites. +- Control (sudo) user for configuring server. +- Docker +- DDEV +- GitHub runners, one per repository. Usage ----- -Copy the example workflows located at [examples/.github/workflows](./examples/.github/workflows) to your projects `.github/workflows` folder. - -The workflows allow all tasks that need to run against your site to be logged in GitHub actions. - -- [deploy.yml](./examples/.github/workflows/deploy.yml) - Deploys fixed sites like live/test/dev when specific branches are pushed. -- [pull-request.yml](./examples/.github/workflows/pull-request.yml) - Deploys pull request environments. -- [pull-request-closed.yml](./examples/.github/workflows/pull-request-closed.yml) - Removes pull request environments. -- [cron.yml](./examples/.github/workflows/cron.yml) - Runs Drupal crontab as a scheduled workflow. +Copy the `example.*.yml` workflows located at [.github/workflows/](.github/workflows) to your projects `.github/workflows` folder. Pull Requests and Live Environments must be handled in separate files, so that live sites only deploy on specific branches. -```yaml -# ./.github/workflows/pull-requests.yml -name: Pull Requests -on: [pull_request] -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: operations-project/site-runner-ddev@main - with: - # Set to "yes" to run the "sync-command". THIS WILL DESTROY THE SITE DATA. - sync: "yes" - - # The command to run to sync up the site with data. - # The default (shown) assumes you have a drush alias of @live. - sync-command: "ddev drush sql:sync @live @self" - - # Add SSH information to GitHub secrets to connect to remote servers. - # Command to get SSH_KNOWN_HOSTS: - # ssh-keyscan -H yourliveserver.com -H github.com - ssh-known-hosts: ${{ secrets.SSH_KNOWN_HOSTS }} - - # Put a private key in secrets and in the live sites `.ssh/authorized_keys` file. - ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} - - # The DDEV `project_tld` config option determines the URLs that are created for the sites. - # You can set the TLD here, or use the GitHub Runner user's global ddev config. - ddev-project-tld: "ci.myserver.com" - - # A list of domains to apply to this environment. Must be a string because of github actions. - ddev-fqdns: | - - preview.${{ github.event.number }}.ci.thinkdrop.net +For a complete example, see [.github/workflows/example.site.preview.yml](.github/workflows/example.site.preview.yml) # ... then your own project steps ... ``` From 93cee94c3bb7729b454cdcf38420664bcf840017 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Thu, 30 Oct 2025 08:40:51 -0400 Subject: [PATCH 097/138] Create operations.site.command.yml for running any command. --- .github/workflows/operations.site.command.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/workflows/operations.site.command.yml diff --git a/.github/workflows/operations.site.command.yml b/.github/workflows/operations.site.command.yml new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/.github/workflows/operations.site.command.yml @@ -0,0 +1 @@ + From 65fabea9a257121e5862e89cd24a90e555690a11 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Thu, 30 Oct 2025 08:46:14 -0400 Subject: [PATCH 098/138] Add workflow to run arbitrary command. --- .github/workflows/operations.site.command.yml | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/.github/workflows/operations.site.command.yml b/.github/workflows/operations.site.command.yml index 8b13789..fab5cab 100644 --- a/.github/workflows/operations.site.command.yml +++ b/.github/workflows/operations.site.command.yml @@ -1 +1,50 @@ +# +# Site Command. Use to run any command. +# +name: ${{ inputs.workflow_name }} +on: + workflow_call: + inputs: + git_root: + required: true + type: string + description: The path to the existing DDEV site. + + command: + type: string + description: The command to run. + required: true + + github_runs_on: + type: string + default: ubuntu-latest + description: The label of the runner you wish to use. + + workflow_name: + type: string + default: Run command + description: testing. + +jobs: + run-command: + name: Run command + runs-on: ${{ inputs.github_runs_on }} + steps: + - uses: actions/checkout@v4 + with: + repository: 'jonpugh/goatscripts' + ref: 'v1.1.0' + path: goatscripts + + - name: Set environment + run: echo "$GITHUB_WORKSPACE/goatscripts/src" >> $GITHUB_PATH + + - name: run command + env: + SUCCESS: ":check: Command complete" + ERROR: ":x: Command failed" + SUMMARY: | + - Root: ${{ inputs.git_root }} + run: | + run-with-summary ${{ inputs.command }} From 748d28e9e5c9a72c32bcd63fd66a7596015591f6 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Thu, 30 Oct 2025 08:48:56 -0400 Subject: [PATCH 099/138] Implement "command" workflow in main preview template. --- .github/workflows/example.site.preview.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/example.site.preview.yml b/.github/workflows/example.site.preview.yml index 25618a0..a98fbe2 100644 --- a/.github/workflows/example.site.preview.yml +++ b/.github/workflows/example.site.preview.yml @@ -82,6 +82,15 @@ jobs: - admin.pr${{ github.event.number }}.sites.thinkdrop.net - ddev-runner.ddev.site + run-command: + name: DDEV Status + uses: operations-project/github-action-ddev-runner/.github/workflows/operations.site.command.yml@feature/reusable-workflows + needs: create-site + with: + git_root: /home/runner/ourproject/pr${{ github.event.number }} + github_runs_on: github.actions.runner.${{ github.run_id }} + command: ddev status + test-site: name: Run tests needs: create-site From d40b8f99aec5bcfc0bdc65c319eb311967e4d11b Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Thu, 30 Oct 2025 08:49:37 -0400 Subject: [PATCH 100/138] Rename workflow name to 'Run command' --- .github/workflows/operations.site.command.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/operations.site.command.yml b/.github/workflows/operations.site.command.yml index fab5cab..ff0e84e 100644 --- a/.github/workflows/operations.site.command.yml +++ b/.github/workflows/operations.site.command.yml @@ -1,7 +1,7 @@ # # Site Command. Use to run any command. # -name: ${{ inputs.workflow_name }} +name: Run command on: workflow_call: inputs: From ade5d2b1e1ba89942251757c9e21e30e6ed76c60 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Thu, 30 Oct 2025 08:52:36 -0400 Subject: [PATCH 101/138] Run in working-directory. --- .github/workflows/operations.site.command.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/operations.site.command.yml b/.github/workflows/operations.site.command.yml index ff0e84e..7c8df33 100644 --- a/.github/workflows/operations.site.command.yml +++ b/.github/workflows/operations.site.command.yml @@ -46,5 +46,6 @@ jobs: ERROR: ":x: Command failed" SUMMARY: | - Root: ${{ inputs.git_root }} + working-directory: ${{ inputs.git_root }} run: | run-with-summary ${{ inputs.command }} From 5cff95acfb637230f3c3bd55d47c168cf1a9a87e Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Thu, 30 Oct 2025 09:00:21 -0400 Subject: [PATCH 102/138] Change input to working_directory --- .github/workflows/operations.site.command.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/operations.site.command.yml b/.github/workflows/operations.site.command.yml index 7c8df33..3fba676 100644 --- a/.github/workflows/operations.site.command.yml +++ b/.github/workflows/operations.site.command.yml @@ -6,10 +6,10 @@ on: workflow_call: inputs: - git_root: + working_directory: required: true type: string - description: The path to the existing DDEV site. + description: The path to run the command in. command: type: string From 9aa309713cdc289cd21e1533cb211d54cc344be8 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 31 Oct 2025 08:10:41 -0400 Subject: [PATCH 103/138] Use goatscripts github action. --- .../workflows/operations.site.deploy.ddev.yml | 27 ++++--------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/.github/workflows/operations.site.deploy.ddev.yml b/.github/workflows/operations.site.deploy.ddev.yml index e177be3..24f3f4f 100644 --- a/.github/workflows/operations.site.deploy.ddev.yml +++ b/.github/workflows/operations.site.deploy.ddev.yml @@ -96,12 +96,7 @@ jobs: runs-on: ${{ inputs.github_runs_on }} steps: - - - uses: actions/checkout@v4 - with: - repository: 'jonpugh/goatscripts' - ref: 'v1.1.0' - path: goatscripts + - uses: jonpugh/goatscripts@v1 - name: Clone code env: @@ -178,12 +173,8 @@ jobs: echo "project_tld: ${{ inputs.ddev_project_tld }}" >> ${{ inputs.ddev_config_filename }} echo "${{ inputs.ddev_config }}" >> ${{ inputs.ddev_config_filename }} echo "$GITHUB_WORKSPACE/goatscripts/src" >> $GITHUB_PATH - - - uses: actions/checkout@v4 - with: - repository: 'jonpugh/goatscripts' - ref: 'v1.1.0' - path: goatscripts + + - uses: jonpugh/goatscripts@v1 - name: Start site working-directory: ${{ inputs.git_root }} @@ -207,16 +198,8 @@ jobs: steps: - - uses: actions/checkout@v4 - with: - repository: 'jonpugh/goatscripts' - ref: 'main' - path: goatscripts - - - name: Set environment - run: | - echo "$GITHUB_WORKSPACE/goatscripts/src" >> $GITHUB_PATH - + - uses: jonpugh/goatscripts@v1 + - name: Prepare data working-directory: ${{ inputs.git_root }} if: ${{ inputs.run_prepare_command }} From 6567718296d777027a25fad3c7d07a8ba3dc0d7a Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 31 Oct 2025 08:13:04 -0400 Subject: [PATCH 104/138] Wrong input. --- .github/workflows/example.site.preview.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/example.site.preview.yml b/.github/workflows/example.site.preview.yml index a98fbe2..b423655 100644 --- a/.github/workflows/example.site.preview.yml +++ b/.github/workflows/example.site.preview.yml @@ -87,7 +87,7 @@ jobs: uses: operations-project/github-action-ddev-runner/.github/workflows/operations.site.command.yml@feature/reusable-workflows needs: create-site with: - git_root: /home/runner/ourproject/pr${{ github.event.number }} + working_directory: /home/runner/ourproject/pr${{ github.event.number }} github_runs_on: github.actions.runner.${{ github.run_id }} command: ddev status From ada6b2204172b920df9202c988a08eb46ee4c4d2 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 31 Oct 2025 08:15:39 -0400 Subject: [PATCH 105/138] Update operations.site.deploy.ddev.yml --- .github/workflows/operations.site.deploy.ddev.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/operations.site.deploy.ddev.yml b/.github/workflows/operations.site.deploy.ddev.yml index 24f3f4f..49912a3 100644 --- a/.github/workflows/operations.site.deploy.ddev.yml +++ b/.github/workflows/operations.site.deploy.ddev.yml @@ -172,7 +172,6 @@ jobs: echo "name: ${{ inputs.ddev_project_name }}" >> ${{ inputs.ddev_config_filename }} echo "project_tld: ${{ inputs.ddev_project_tld }}" >> ${{ inputs.ddev_config_filename }} echo "${{ inputs.ddev_config }}" >> ${{ inputs.ddev_config_filename }} - echo "$GITHUB_WORKSPACE/goatscripts/src" >> $GITHUB_PATH - uses: jonpugh/goatscripts@v1 From 6d9d60a0b9f99298cbedf9546b29704a44976b3a Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 31 Oct 2025 08:19:52 -0400 Subject: [PATCH 106/138] Update operations.site.deploy.ddev.yml --- .github/workflows/operations.site.deploy.ddev.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/operations.site.deploy.ddev.yml b/.github/workflows/operations.site.deploy.ddev.yml index 49912a3..a0599f4 100644 --- a/.github/workflows/operations.site.deploy.ddev.yml +++ b/.github/workflows/operations.site.deploy.ddev.yml @@ -111,8 +111,6 @@ jobs: - Pull Request: ${{ github.event.pull_request.html_url }} run: | - export PATH=$GITHUB_WORKSPACE/goatscripts/src:$PATH - echo $PATH if [[ ! -d ${{ inputs.git_root }} ]]; then run-with-summary git clone ${{ inputs.git_repository }} ${{ inputs.git_root }} fi From 78823442e592830f0c8395b1b48a7e8e00255f55 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 31 Oct 2025 08:26:45 -0400 Subject: [PATCH 107/138] Use latest github action. --- .github/workflows/operations.site.deploy.ddev.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/operations.site.deploy.ddev.yml b/.github/workflows/operations.site.deploy.ddev.yml index a0599f4..542e428 100644 --- a/.github/workflows/operations.site.deploy.ddev.yml +++ b/.github/workflows/operations.site.deploy.ddev.yml @@ -96,7 +96,7 @@ jobs: runs-on: ${{ inputs.github_runs_on }} steps: - - uses: jonpugh/goatscripts@v1 + - uses: jonpugh/goatscripts@main - name: Clone code env: @@ -171,7 +171,7 @@ jobs: echo "project_tld: ${{ inputs.ddev_project_tld }}" >> ${{ inputs.ddev_config_filename }} echo "${{ inputs.ddev_config }}" >> ${{ inputs.ddev_config_filename }} - - uses: jonpugh/goatscripts@v1 + - uses: jonpugh/goatscripts@main - name: Start site working-directory: ${{ inputs.git_root }} @@ -195,7 +195,7 @@ jobs: steps: - - uses: jonpugh/goatscripts@v1 + - uses: jonpugh/goatscripts@main - name: Prepare data working-directory: ${{ inputs.git_root }} From 535250dde35760a3a01a596a5f3dd8778e25998a Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 31 Oct 2025 08:31:46 -0400 Subject: [PATCH 108/138] Wait a second before starting the runner in case the job isn't available yet. --- .github/workflows/example.site.preview.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/example.site.preview.yml b/.github/workflows/example.site.preview.yml index b423655..c2be692 100644 --- a/.github/workflows/example.site.preview.yml +++ b/.github/workflows/example.site.preview.yml @@ -37,12 +37,12 @@ jobs: run: | while [[ $(curl -s -H "Authorization: token ${GITHUB_TOKEN}" "https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/jobs" | jq -r '.jobs[] | select(.status=="queued") | .id' | wc -l) -gt 0 ]]; do + sleep 2 ./github-runner-starter \ --run \ --name=github.actions.runner.${{ github.run_id }}.${{ matrix.runner }} \ --labels=github.actions.runner.${{ github.run_id }} \ --config-sh-options=--ephemeral - sleep 3 done create-site: From 198c10e26c577b798103f4e10693e33f6343d1a0 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 31 Oct 2025 08:36:45 -0400 Subject: [PATCH 109/138] Use correct directory,. --- .github/workflows/operations.site.command.yml | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/.github/workflows/operations.site.command.yml b/.github/workflows/operations.site.command.yml index 3fba676..07d9cb1 100644 --- a/.github/workflows/operations.site.command.yml +++ b/.github/workflows/operations.site.command.yml @@ -31,21 +31,14 @@ jobs: name: Run command runs-on: ${{ inputs.github_runs_on }} steps: - - uses: actions/checkout@v4 - with: - repository: 'jonpugh/goatscripts' - ref: 'v1.1.0' - path: goatscripts - - - name: Set environment - run: echo "$GITHUB_WORKSPACE/goatscripts/src" >> $GITHUB_PATH + - uses: jonpugh/goatscripts@main - name: run command env: SUCCESS: ":check: Command complete" ERROR: ":x: Command failed" SUMMARY: | - - Root: ${{ inputs.git_root }} - working-directory: ${{ inputs.git_root }} + - Root: `${{ inputs.working_directory }}` + working-directory: ${{ inputs.working_directory }} run: | run-with-summary ${{ inputs.command }} From d87ae4c61be50a8ac7c723e34ef9bcefaad3f197 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Fri, 31 Oct 2025 08:38:54 -0400 Subject: [PATCH 110/138] sleep before and after. --- .github/workflows/example.site.preview.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/example.site.preview.yml b/.github/workflows/example.site.preview.yml index c2be692..1068214 100644 --- a/.github/workflows/example.site.preview.yml +++ b/.github/workflows/example.site.preview.yml @@ -24,7 +24,7 @@ jobs: # This emulates a persistent server. The ddev.site.deploy.yml jobs require one. # This job runs the rest. It will stay running until the last job is complete. create-server: - name: Launch a test server + name: Launch test runner runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -43,6 +43,7 @@ jobs: --name=github.actions.runner.${{ github.run_id }}.${{ matrix.runner }} \ --labels=github.actions.runner.${{ github.run_id }} \ --config-sh-options=--ephemeral + sleep 2 done create-site: From 4a931d9bb41004290b451eb9de9ebcec7eb9fda4 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Sat, 1 Nov 2025 10:45:48 -0400 Subject: [PATCH 111/138] Update and rename example.site.preview.yml to test.ddev.workflows.yml --- .../{example.site.preview.yml => test.ddev.workflows.yml} | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) rename .github/workflows/{example.site.preview.yml => test.ddev.workflows.yml} (94%) diff --git a/.github/workflows/example.site.preview.yml b/.github/workflows/test.ddev.workflows.yml similarity index 94% rename from .github/workflows/example.site.preview.yml rename to .github/workflows/test.ddev.workflows.yml index 1068214..9273d97 100644 --- a/.github/workflows/example.site.preview.yml +++ b/.github/workflows/test.ddev.workflows.yml @@ -1,10 +1,10 @@ # -# Operations Project Workflow: Example Pull Request Site workflow. +# This workflow is for testing the re-usable ones workflows. # -# This example workflow uses the reusable workflow operations.site.deploy.ddev.yml. -# You can copy this into your project. +# It contains multiple steps, including starting and tearing down a site. +# It doesn't make sense to use this example directly. # -# See https://github.com/operations-project/site-runner-ddev for more information. +# See the example.* files for that. # name: Preview Sites on: From bbe0de23a8b1620eb1702d9ba5209f6a28b82a28 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Sat, 1 Nov 2025 10:57:26 -0400 Subject: [PATCH 112/138] Create site.preview.yml.example --- .github/workflows/site.preview.yml.example | 81 ++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 .github/workflows/site.preview.yml.example diff --git a/.github/workflows/site.preview.yml.example b/.github/workflows/site.preview.yml.example new file mode 100644 index 0000000..e90c831 --- /dev/null +++ b/.github/workflows/site.preview.yml.example @@ -0,0 +1,81 @@ +# +# site.preview.yml +# +# Launch and test preview sites for each pull request. +# +# Requires a runner on a persistant server. +# +name: Preview Site +on: + pull_request: + +# Cancel jobs if another push is received. +concurrency: + group: ${{ github.workflow }}-${{ github.event.number }} + cancel-in-progress: false + +jobs: + + # Installs DDEV, clones code, starts the site. + create-site: + name: Create Preview Site + uses: operations-project/github-action-ddev-runner/.github/workflows/operations.site.deploy.ddev.yml@feature/reusable-workflows + with: + + # Where to install your site. + git_root: /home/runner/Sites/${{ github.repository }}/pr${{ github.event.number }} + + # Project name for this instance. Used to generate the domain name. + ddev_project_name: yourproject.pr${{ github.event.number }} + + # Top-level domain. Sites are hosted as subdomains under this. + ddev_project_tld: preview.yourproject.com + + # Tell the remote workflow what to run on. + github_runs_on: self-hosted + + # Define the github environment name, to be displayed in the UI. + github_environment_name: pr${{ github.event.number }} + + # Define a github environment url, a link to be shown on the pull request. + github_environment_url: http://yourproject.pr${{ github.event.number }}.preview.yourproject.com + + # To persist a site's data, set "run_prepare_command" to false. + run_prepare_command: true + + # Prepare the site's data. Run your sync/import/install script. + prepare_command: ddev drush site:install + + # Command to run after deploying code changes + deploy_command: ddev drush updb + + # Additional ddev config to apply to the environment. + # Will be saved to .ddev/config.zzz.runner.yaml + # See your project's .ddev/config.yaml file for examples. + ddev_config: | + additional_fqdns: + - admin.pr${{ github.event.number }}.preview.yourproject.com + + run-command: + name: DDEV Status + uses: operations-project/github-action-ddev-runner/.github/workflows/operations.site.command.yml@feature/reusable-workflows + needs: create-site + with: + working_directory: /home/runner/Sites/${{ github.repository }}/pr${{ github.event.number }} + github_runs_on: self-hosted + command: | + ddev status + + test-site: + name: Run tests + needs: run-command + runs-on: self-hosted + steps: + - uses: jonpugh/goatscripts@main + - name: Check homepage + env: + SUCCESS: "Tests pass. :check:" + ERROR: "TESTS FAILED! :x:" + run: | + run-with-summary curl http://pr${{ github.event.number }}.sites.thinkdrop.net + curl -s http://yourproject.pr${{ github.event.number }}.preview.yourproject.com | grep "Hello World!" From 52bc9dc47254750c0f72f6a68cdb704fe2feedb7 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Sat, 1 Nov 2025 11:05:10 -0400 Subject: [PATCH 113/138] Make sure the parent directory exists. --- .github/workflows/operations.site.deploy.ddev.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/operations.site.deploy.ddev.yml b/.github/workflows/operations.site.deploy.ddev.yml index 542e428..323cb18 100644 --- a/.github/workflows/operations.site.deploy.ddev.yml +++ b/.github/workflows/operations.site.deploy.ddev.yml @@ -112,6 +112,7 @@ jobs: run: | if [[ ! -d ${{ inputs.git_root }} ]]; then + mkdir -p $(dirname ${{ inputs.git_root }}) run-with-summary git clone ${{ inputs.git_repository }} ${{ inputs.git_root }} fi cd ${{ inputs.git_root }} From 6b3c046b6ce32cdb97fc781be4b0effa9b4837e8 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Sat, 1 Nov 2025 11:16:54 -0400 Subject: [PATCH 114/138] Use SSH URL to clone by default. --- .github/workflows/operations.site.deploy.ddev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/operations.site.deploy.ddev.yml b/.github/workflows/operations.site.deploy.ddev.yml index 323cb18..bc65b4c 100644 --- a/.github/workflows/operations.site.deploy.ddev.yml +++ b/.github/workflows/operations.site.deploy.ddev.yml @@ -11,7 +11,7 @@ on: inputs: git_repository: - default: ${{ github.event.repository.clone_url }} + default: ${{ github.event.repository.ssh_url }} type: string description: The repository to deploy. From ce04f7d43e9cb81eda77f1cb5c67bac61a45c7cc Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Sat, 1 Nov 2025 11:18:10 -0400 Subject: [PATCH 115/138] No need for this. --- .github/workflows/operations.site.deploy.ddev.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/operations.site.deploy.ddev.yml b/.github/workflows/operations.site.deploy.ddev.yml index bc65b4c..71c5f47 100644 --- a/.github/workflows/operations.site.deploy.ddev.yml +++ b/.github/workflows/operations.site.deploy.ddev.yml @@ -112,7 +112,6 @@ jobs: run: | if [[ ! -d ${{ inputs.git_root }} ]]; then - mkdir -p $(dirname ${{ inputs.git_root }}) run-with-summary git clone ${{ inputs.git_repository }} ${{ inputs.git_root }} fi cd ${{ inputs.git_root }} From 9d5e43cfe5beb618e59d380a33b26f771952c41f Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Sat, 1 Nov 2025 11:20:46 -0400 Subject: [PATCH 116/138] Set DDEV_NONINTERACTIVE --- .github/workflows/operations.site.deploy.ddev.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/operations.site.deploy.ddev.yml b/.github/workflows/operations.site.deploy.ddev.yml index 71c5f47..77b2415 100644 --- a/.github/workflows/operations.site.deploy.ddev.yml +++ b/.github/workflows/operations.site.deploy.ddev.yml @@ -90,6 +90,9 @@ on: default: ${{ inputs.ddev_project_name }}.${{ inputs.ddev_project_tld }} description: The URL to use for the GitHub environment. +env: + DDEV_NONINTERACTIVE: true + jobs: deploy-code: name: Deploy Code From a3f12ee2448d03a8ef03f355f12e7d2d7ab79c56 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Sat, 1 Nov 2025 11:24:58 -0400 Subject: [PATCH 117/138] Testing receiving env vars --- .github/workflows/operations.site.deploy.ddev.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/operations.site.deploy.ddev.yml b/.github/workflows/operations.site.deploy.ddev.yml index 77b2415..aa1d13a 100644 --- a/.github/workflows/operations.site.deploy.ddev.yml +++ b/.github/workflows/operations.site.deploy.ddev.yml @@ -23,6 +23,7 @@ on: git_root: required: true type: string + default: ${{ env.GIT_ROOT }} description: The path to clone the repository into, relative to the runner workspace. Use absolute paths when running a persistent server. start_command: From bcd2639d80b2ccac8252713dfc02569ebbe7fc0b Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Sat, 1 Nov 2025 13:14:42 -0400 Subject: [PATCH 118/138] Can't use env. here. --- .github/workflows/operations.site.deploy.ddev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/operations.site.deploy.ddev.yml b/.github/workflows/operations.site.deploy.ddev.yml index aa1d13a..4e1a784 100644 --- a/.github/workflows/operations.site.deploy.ddev.yml +++ b/.github/workflows/operations.site.deploy.ddev.yml @@ -23,7 +23,6 @@ on: git_root: required: true type: string - default: ${{ env.GIT_ROOT }} description: The path to clone the repository into, relative to the runner workspace. Use absolute paths when running a persistent server. start_command: @@ -100,6 +99,7 @@ jobs: runs-on: ${{ inputs.github_runs_on }} steps: + - run: env - uses: jonpugh/goatscripts@main - name: Clone code From b0f40ad39da5a7c7058b90ddffffaadf72b71f2b Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Sat, 1 Nov 2025 13:41:47 -0400 Subject: [PATCH 119/138] Don't forget to pull latest. --- .github/workflows/operations.site.deploy.ddev.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/operations.site.deploy.ddev.yml b/.github/workflows/operations.site.deploy.ddev.yml index 4e1a784..feb300b 100644 --- a/.github/workflows/operations.site.deploy.ddev.yml +++ b/.github/workflows/operations.site.deploy.ddev.yml @@ -116,10 +116,11 @@ jobs: run: | if [[ ! -d ${{ inputs.git_root }} ]]; then - run-with-summary git clone ${{ inputs.git_repository }} ${{ inputs.git_root }} + run-with-summary git clone --recursive ${{ inputs.git_repository }} ${{ inputs.git_root }} fi cd ${{ inputs.git_root }} - git checkout ${{ inputs.git_reference }} + git fetch origin + git checkout --force ${{ inputs.git_reference }} SUMMARY="" From 763f24d80e5b2b3ea39914456ea388f2bac29977 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Sat, 1 Nov 2025 13:47:43 -0400 Subject: [PATCH 120/138] Fetch and reset, --- .../workflows/operations.site.deploy.ddev.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/operations.site.deploy.ddev.yml b/.github/workflows/operations.site.deploy.ddev.yml index feb300b..c648325 100644 --- a/.github/workflows/operations.site.deploy.ddev.yml +++ b/.github/workflows/operations.site.deploy.ddev.yml @@ -119,17 +119,21 @@ jobs: run-with-summary git clone --recursive ${{ inputs.git_repository }} ${{ inputs.git_root }} fi cd ${{ inputs.git_root }} - git fetch origin - git checkout --force ${{ inputs.git_reference }} - + SUMMARY="" + + SUCCESS="Pre-deploy git status" \ + run-with-summary git log -1 - SUCCESS="git status" \ - run-with-summary git status + git fetch + git reset --hard origin/${{ inputs.git_reference }} - SUCCESS="git log" \ + SUCCESS="Post deploy git status" \ run-with-summary git log -1 + SUCCESS="git status" \ + run-with-summary git status + start-site: name: Start site runs-on: ${{ inputs.github_runs_on }} From 97978d4f02c125477e3f864cad7da87f52a6bd96 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Sat, 1 Nov 2025 13:53:38 -0400 Subject: [PATCH 121/138] Hide process details table in summaries. --- .github/workflows/operations.site.deploy.ddev.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/operations.site.deploy.ddev.yml b/.github/workflows/operations.site.deploy.ddev.yml index c648325..c60a47f 100644 --- a/.github/workflows/operations.site.deploy.ddev.yml +++ b/.github/workflows/operations.site.deploy.ddev.yml @@ -91,7 +91,11 @@ on: description: The URL to use for the GitHub environment. env: + # Tell ddev to not set /etc/hosts file. DDEV_NONINTERACTIVE: true + + # Tell run-with-summary to skip the details table. + HIDE: true jobs: deploy-code: From c1a5c7a010ee0399620948b52b7a6700598bc333 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Sat, 1 Nov 2025 14:07:38 -0400 Subject: [PATCH 122/138] Fix emoji used for command complete --- .github/workflows/operations.site.command.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/operations.site.command.yml b/.github/workflows/operations.site.command.yml index 07d9cb1..6b51825 100644 --- a/.github/workflows/operations.site.command.yml +++ b/.github/workflows/operations.site.command.yml @@ -35,7 +35,7 @@ jobs: - name: run command env: - SUCCESS: ":check: Command complete" + SUCCESS: ":white_check_mark: Command complete" ERROR: ":x: Command failed" SUMMARY: | - Root: `${{ inputs.working_directory }}` From 6f4b00673656a7f0b44aa6b68c0cf12934d2419f Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Sat, 1 Nov 2025 14:10:22 -0400 Subject: [PATCH 123/138] Attempt to add "env" input --- .github/workflows/operations.site.command.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/operations.site.command.yml b/.github/workflows/operations.site.command.yml index 6b51825..2dfaea8 100644 --- a/.github/workflows/operations.site.command.yml +++ b/.github/workflows/operations.site.command.yml @@ -21,10 +21,11 @@ on: default: ubuntu-latest description: The label of the runner you wish to use. - workflow_name: + env: type: string - default: Run command - description: testing. + default: Environment + description: | + A string of environment variables to set for the command run. To alter the summary, see https://github.com/jonpugh/goatscripts/blob/main/src/run-with-summary jobs: run-command: @@ -41,4 +42,5 @@ jobs: - Root: `${{ inputs.working_directory }}` working-directory: ${{ inputs.working_directory }} run: | + ${{ inputs.env }} run-with-summary ${{ inputs.command }} From 896c7219e3f6a3c0539dd04e23b39eac54838a23 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Sat, 1 Nov 2025 14:11:09 -0400 Subject: [PATCH 124/138] Try to set env input. --- .github/workflows/test.ddev.workflows.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test.ddev.workflows.yml b/.github/workflows/test.ddev.workflows.yml index 9273d97..fa4186f 100644 --- a/.github/workflows/test.ddev.workflows.yml +++ b/.github/workflows/test.ddev.workflows.yml @@ -91,6 +91,9 @@ jobs: working_directory: /home/runner/ourproject/pr${{ github.event.number }} github_runs_on: github.actions.runner.${{ github.run_id }} command: ddev status + env: | + SUCCESS="DDEV Status" + HIDE=1 test-site: name: Run tests From 85f03a13fe723e5a7a55e9462afe3b7c00648630 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Sat, 1 Nov 2025 14:20:50 -0400 Subject: [PATCH 125/138] Set the git_repository to public url. --- .github/workflows/test.ddev.workflows.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test.ddev.workflows.yml b/.github/workflows/test.ddev.workflows.yml index fa4186f..96df78c 100644 --- a/.github/workflows/test.ddev.workflows.yml +++ b/.github/workflows/test.ddev.workflows.yml @@ -53,6 +53,9 @@ jobs: # Configure your site here. git_root: /home/runner/ourproject/pr${{ github.event.number }} + + # Use the http URL. + git_repository: ${{ github.event.repository.clone_url }} # Must be unique per server. ddev_project_name: ourproject.pr${{ github.event.number }} From fb0ca25a4110d896634ec8c51ea9d74d3b317dc6 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Sat, 1 Nov 2025 14:26:26 -0400 Subject: [PATCH 126/138] Use action to install. --- .github/workflows/test.ddev.workflows.yml | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/.github/workflows/test.ddev.workflows.yml b/.github/workflows/test.ddev.workflows.yml index 96df78c..9a44b4a 100644 --- a/.github/workflows/test.ddev.workflows.yml +++ b/.github/workflows/test.ddev.workflows.yml @@ -104,16 +104,7 @@ jobs: runs-on: github.actions.runner.${{ github.run_id }} steps: - - uses: actions/checkout@v4 - with: - repository: 'jonpugh/goatscripts' - ref: 'main' - path: goatscripts - - - name: Set environment - run: | - echo "$GITHUB_WORKSPACE/goatscripts/src" >> $GITHUB_PATH - + - uses: jonpugh/goatscripts@main - name: Check homepage for Hello World. env: SUCCESS: "Tests passed! DDEV webserver is online. :boom:" @@ -121,8 +112,6 @@ jobs: run: | run-with-summary curl https://ddev-runner.ddev.site curl -s https://ddev-runner.ddev.site | grep "Hello World!" -# Not writing ddev config yet. -# curl -s http://pr${{ github.event.number }}.sites.thinkdrop.net remove-site: name: Remove Site From 00b313435556614b6da9f7f7e6b98c4fc99dd30b Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Sat, 1 Nov 2025 14:28:55 -0400 Subject: [PATCH 127/138] No default. --- .github/workflows/operations.site.command.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/operations.site.command.yml b/.github/workflows/operations.site.command.yml index 2dfaea8..f8755a6 100644 --- a/.github/workflows/operations.site.command.yml +++ b/.github/workflows/operations.site.command.yml @@ -23,7 +23,6 @@ on: env: type: string - default: Environment description: | A string of environment variables to set for the command run. To alter the summary, see https://github.com/jonpugh/goatscripts/blob/main/src/run-with-summary From f0eb1c4e17cf335e74a375dc17ebabe507873bf6 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Sat, 1 Nov 2025 16:33:26 -0400 Subject: [PATCH 128/138] Checkout the branch --- .github/workflows/operations.site.deploy.ddev.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/operations.site.deploy.ddev.yml b/.github/workflows/operations.site.deploy.ddev.yml index c60a47f..7ed6049 100644 --- a/.github/workflows/operations.site.deploy.ddev.yml +++ b/.github/workflows/operations.site.deploy.ddev.yml @@ -130,6 +130,7 @@ jobs: run-with-summary git log -1 git fetch + git checkout ${{ inputs.git_reference }} git reset --hard origin/${{ inputs.git_reference }} SUCCESS="Post deploy git status" \ From 7e4f0c35f7c9f3215c35a85e9262bf598176b55f Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Sat, 1 Nov 2025 17:00:41 -0400 Subject: [PATCH 129/138] Skip prepare job completely. --- .github/workflows/operations.site.deploy.ddev.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/operations.site.deploy.ddev.yml b/.github/workflows/operations.site.deploy.ddev.yml index 7ed6049..a71588e 100644 --- a/.github/workflows/operations.site.deploy.ddev.yml +++ b/.github/workflows/operations.site.deploy.ddev.yml @@ -201,6 +201,7 @@ jobs: name: Prepare data runs-on: ${{ inputs.github_runs_on }} needs: start-site + if: ${{ inputs.run_prepare_command && inputs.prepare_command}} # Show links to this environment in the UI to the site. environment: @@ -213,7 +214,6 @@ jobs: - name: Prepare data working-directory: ${{ inputs.git_root }} - if: ${{ inputs.run_prepare_command }} env: SUCCESS: "Site data preparation successful :rocket:" ERROR: "Site data preparation failed :x:" @@ -222,7 +222,6 @@ jobs: - name: Deploy command working-directory: ${{ inputs.git_root }} - if: ${{ inputs.run_deploy_command }} env: SUCCESS: "Deploy successful :rocket:" ERROR: "Deploy failed :x:" From e0b7a327844a77be4ea022bb799cfdde60035d23 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Sat, 1 Nov 2025 17:05:32 -0400 Subject: [PATCH 130/138] Set deployment environment name and URL on the start site job, In case prepare site does not run. --- .github/workflows/operations.site.deploy.ddev.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/operations.site.deploy.ddev.yml b/.github/workflows/operations.site.deploy.ddev.yml index a71588e..7fd2458 100644 --- a/.github/workflows/operations.site.deploy.ddev.yml +++ b/.github/workflows/operations.site.deploy.ddev.yml @@ -144,6 +144,11 @@ jobs: runs-on: ${{ inputs.github_runs_on }} needs: deploy-code + # Show links to this environment in the UI to the site. + environment: + name: ${{ inputs.github_environment_name }} + url: "${{ inputs.github_environment_url }}" + steps: - name: Check DDEV Installation run: | From 0060d79043cf45e39967acb374505ea3ee84cf56 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Sat, 22 Nov 2025 08:29:58 -0500 Subject: [PATCH 131/138] Labels --- .../workflows/operations.site.deploy.ddev.yml | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/operations.site.deploy.ddev.yml b/.github/workflows/operations.site.deploy.ddev.yml index 7fd2458..722f2ac 100644 --- a/.github/workflows/operations.site.deploy.ddev.yml +++ b/.github/workflows/operations.site.deploy.ddev.yml @@ -103,8 +103,12 @@ jobs: runs-on: ${{ inputs.github_runs_on }} steps: - - run: env - - uses: jonpugh/goatscripts@main + + - name: Show environment + run: env + + - name: Install scripts + uses: jonpugh/goatscripts@main - name: Clone code env: @@ -189,9 +193,10 @@ jobs: echo "name: ${{ inputs.ddev_project_name }}" >> ${{ inputs.ddev_config_filename }} echo "project_tld: ${{ inputs.ddev_project_tld }}" >> ${{ inputs.ddev_config_filename }} echo "${{ inputs.ddev_config }}" >> ${{ inputs.ddev_config_filename }} - - - uses: jonpugh/goatscripts@main - + + - name: Install scripts + uses: jonpugh/goatscripts@main + - name: Start site working-directory: ${{ inputs.git_root }} if: ${{ inputs.run_start_command }} @@ -215,8 +220,9 @@ jobs: steps: - - uses: jonpugh/goatscripts@main - + - name: Install scripts + uses: jonpugh/goatscripts@main + - name: Prepare data working-directory: ${{ inputs.git_root }} env: From dea496c415983d9c750c235b067cf96dd3bc9c50 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Mon, 24 Nov 2025 07:24:52 -0500 Subject: [PATCH 132/138] Add SSH agent --- .../workflows/operations.site.deploy.ddev.yml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/operations.site.deploy.ddev.yml b/.github/workflows/operations.site.deploy.ddev.yml index 722f2ac..6a92bc6 100644 --- a/.github/workflows/operations.site.deploy.ddev.yml +++ b/.github/workflows/operations.site.deploy.ddev.yml @@ -90,10 +90,15 @@ on: default: ${{ inputs.ddev_project_name }}.${{ inputs.ddev_project_tld }} description: The URL to use for the GitHub environment. + ssh_private_key: + type: string + description: | + A private key with access to your git repository or other servers. + This will be installed with the webfactory/ssh-agent so the key will only be available inside the job. env: # Tell ddev to not set /etc/hosts file. DDEV_NONINTERACTIVE: true - + # Tell run-with-summary to skip the details table. HIDE: true @@ -110,6 +115,11 @@ jobs: - name: Install scripts uses: jonpugh/goatscripts@main + # Enable SSH agent to allow preview sites to clone. + - uses: webfactory/ssh-agent@v0.9.1 + with: + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + - name: Clone code env: SUCCESS: "Codebase successfully cloned :computer:" @@ -152,8 +162,12 @@ jobs: environment: name: ${{ inputs.github_environment_name }} url: "${{ inputs.github_environment_url }}" - + steps: + + - name: Install helper scripts + uses: jonpugh/goatscripts@v1 + - name: Check DDEV Installation run: | if [[ `command -v ddev` ]]; then From acf9cbf3472174b1f46cd835df7ccb34707228a4 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Mon, 24 Nov 2025 07:26:14 -0500 Subject: [PATCH 133/138] Add SSH agents --- .github/workflows/operations.site.deploy.ddev.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/operations.site.deploy.ddev.yml b/.github/workflows/operations.site.deploy.ddev.yml index 6a92bc6..a3cedbd 100644 --- a/.github/workflows/operations.site.deploy.ddev.yml +++ b/.github/workflows/operations.site.deploy.ddev.yml @@ -95,6 +95,7 @@ on: description: | A private key with access to your git repository or other servers. This will be installed with the webfactory/ssh-agent so the key will only be available inside the job. + env: # Tell ddev to not set /etc/hosts file. DDEV_NONINTERACTIVE: true @@ -117,8 +118,9 @@ jobs: # Enable SSH agent to allow preview sites to clone. - uses: webfactory/ssh-agent@v0.9.1 + if: ${{ inputs.SSH_PRIVATE_KEY }} with: - ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + ssh-private-key: ${{ inputs.SSH_PRIVATE_KEY }} - name: Clone code env: @@ -237,6 +239,12 @@ jobs: - name: Install scripts uses: jonpugh/goatscripts@main + # Enable SSH agent. + - uses: webfactory/ssh-agent@v0.9.1 + if: ${{ inputs.SSH_PRIVATE_KEY }} + with: + ssh-private-key: ${{ inputs.SSH_PRIVATE_KEY }} + - name: Prepare data working-directory: ${{ inputs.git_root }} env: From c4309867a6a9c9e66683cfd4121ec061e37ee552 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Mon, 24 Nov 2025 07:37:24 -0500 Subject: [PATCH 134/138] Use secrets instead of inputs. --- .github/workflows/operations.site.deploy.ddev.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/operations.site.deploy.ddev.yml b/.github/workflows/operations.site.deploy.ddev.yml index a3cedbd..e060511 100644 --- a/.github/workflows/operations.site.deploy.ddev.yml +++ b/.github/workflows/operations.site.deploy.ddev.yml @@ -90,12 +90,6 @@ on: default: ${{ inputs.ddev_project_name }}.${{ inputs.ddev_project_tld }} description: The URL to use for the GitHub environment. - ssh_private_key: - type: string - description: | - A private key with access to your git repository or other servers. - This will be installed with the webfactory/ssh-agent so the key will only be available inside the job. - env: # Tell ddev to not set /etc/hosts file. DDEV_NONINTERACTIVE: true @@ -118,9 +112,9 @@ jobs: # Enable SSH agent to allow preview sites to clone. - uses: webfactory/ssh-agent@v0.9.1 - if: ${{ inputs.SSH_PRIVATE_KEY }} + if: ${{ secrets.SSH_PRIVATE_KEY }} with: - ssh-private-key: ${{ inputs.SSH_PRIVATE_KEY }} + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} - name: Clone code env: From 7987132f3c774dcc21981c7e16f6730912d50bb3 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Mon, 24 Nov 2025 07:39:04 -0500 Subject: [PATCH 135/138] Can we use env in if? --- .github/workflows/operations.site.deploy.ddev.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/operations.site.deploy.ddev.yml b/.github/workflows/operations.site.deploy.ddev.yml index e060511..3d8e14c 100644 --- a/.github/workflows/operations.site.deploy.ddev.yml +++ b/.github/workflows/operations.site.deploy.ddev.yml @@ -97,6 +97,9 @@ env: # Tell run-with-summary to skip the details table. HIDE: true + # Start an SSH agent with this private key. + SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} + jobs: deploy-code: name: Deploy Code @@ -112,9 +115,9 @@ jobs: # Enable SSH agent to allow preview sites to clone. - uses: webfactory/ssh-agent@v0.9.1 - if: ${{ secrets.SSH_PRIVATE_KEY }} + if: ${{ env.SSH_PRIVATE_KEY }} with: - ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + ssh-private-key: ${{ env.SSH_PRIVATE_KEY }} - name: Clone code env: From 53540165aec60d1cb9e2d01eb443637c131e57b2 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Mon, 24 Nov 2025 07:43:07 -0500 Subject: [PATCH 136/138] Secrets are like inputs. --- .github/workflows/operations.site.deploy.ddev.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/operations.site.deploy.ddev.yml b/.github/workflows/operations.site.deploy.ddev.yml index 3d8e14c..85849dc 100644 --- a/.github/workflows/operations.site.deploy.ddev.yml +++ b/.github/workflows/operations.site.deploy.ddev.yml @@ -8,6 +8,12 @@ name: Deploy site on: workflow_call: + + secrets: + SSH_PRIVATE_KEY: + description: A private key to use to clone repositories and, optionally, to sync data. + required: false + inputs: git_repository: @@ -115,9 +121,9 @@ jobs: # Enable SSH agent to allow preview sites to clone. - uses: webfactory/ssh-agent@v0.9.1 - if: ${{ env.SSH_PRIVATE_KEY }} + if: ${{ secrets.SSH_PRIVATE_KEY }} with: - ssh-private-key: ${{ env.SSH_PRIVATE_KEY }} + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} - name: Clone code env: From f5003e1ce9e984c0be5b2dc4a5f7da7279ddcd1c Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Mon, 24 Nov 2025 07:44:50 -0500 Subject: [PATCH 137/138] Set SSH_PRIVATE_KEY env var so it can be used in the "if" statement. --- .github/workflows/operations.site.deploy.ddev.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/operations.site.deploy.ddev.yml b/.github/workflows/operations.site.deploy.ddev.yml index 85849dc..03ac8bd 100644 --- a/.github/workflows/operations.site.deploy.ddev.yml +++ b/.github/workflows/operations.site.deploy.ddev.yml @@ -110,6 +110,8 @@ jobs: deploy-code: name: Deploy Code runs-on: ${{ inputs.github_runs_on }} + env: + SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} steps: @@ -121,9 +123,9 @@ jobs: # Enable SSH agent to allow preview sites to clone. - uses: webfactory/ssh-agent@v0.9.1 - if: ${{ secrets.SSH_PRIVATE_KEY }} + if: ${{ env.SSH_PRIVATE_KEY }} with: - ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + ssh-private-key: ${{ env.SSH_PRIVATE_KEY }} - name: Clone code env: From 84f4828d52670b1e985a51b642e47964a5f96413 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Mon, 24 Nov 2025 08:02:13 -0500 Subject: [PATCH 138/138] Checkout code and sync submodules (on new branch, might have new submodules.) --- .github/workflows/operations.site.deploy.ddev.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/operations.site.deploy.ddev.yml b/.github/workflows/operations.site.deploy.ddev.yml index 03ac8bd..96e3860 100644 --- a/.github/workflows/operations.site.deploy.ddev.yml +++ b/.github/workflows/operations.site.deploy.ddev.yml @@ -144,6 +144,8 @@ jobs: run-with-summary git clone --recursive ${{ inputs.git_repository }} ${{ inputs.git_root }} fi cd ${{ inputs.git_root }} + git checkout --force ${{ inputs.git_ref }} + git submodule sync --recursive SUMMARY=""