Feature/reusable workflows #18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | |
| # 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' | |
| # 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 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: | |
| - admin.pr${{ github.event.number }}.sites.thinkdrop.net |