Skip to content

Feature/reusable workflows #21

Feature/reusable workflows

Feature/reusable workflows #21

Workflow file for this run

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.OPERATIONS_GITHUB_TOKEN_ADMIN }}"
concurrency:
group: ${{ github.workflow }}-${{ github.event.number }}
cancel-in-progress: true
jobs:
create-server:
name: Launch a test server
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
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: |
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
done
create-site:
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: /home/runner/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
# Tell the remote workflow what to run on.
github_runs_on: github.actions.runner.${{ github.run_id }}
# 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
ddev_config: |
additional_fqdns:
- admin.pr${{ github.event.number }}.sites.thinkdrop.net