Skip to content

operations-project/github-action-ddev-runner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 

Repository files navigation

DDEV GitHub Actions Runner

This GitHub Action is designed to host real live sites using self-hosted GitHub runners and DDEV.

DDEV is a tool for launching multiple sites on a single server using Docker.

This action makes it easy to clone a site and launch ddev start.

For more detailed documentation and usage examples, see https://operations-project.gitbook.io/operations-experience-project/operations-site-server.

Notes

This action does NOT install ddev.

If using on a self-hosted runner, make sure you install ddev first.

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

Operations Site Runner

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.

Usage

Copy the example workflows located at 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.

Pull Requests and Live Environments must be handled in separate files, so that live sites only deploy on specific branches.

# ./.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

# ... then your own project steps ...

About

GitHub Action for deploying a site with DDEV.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published