- Notifications
You must be signed in to change notification settings - Fork15
A GitHub Action that starts preview deployments for your pull requests and branches. It can work with any application that has a valid Docker Compose file.
License
pullpreview/action
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A GitHub Action that starts live environments for your pull requests and branches.
Once installed in your repository, this action is triggered any time a changeis made to Pull Requests labelled with thepullpreview
label, or one of thealways-on branches.
When triggered, it will:
- Check out the repository code
- Provision a cheap AWS Lightsail instance, with docker and docker-compose set up
- Continuously deploy the specified pull requests and branches, using your docker-compose file(s)
- Report the preview instance URL in the GitHub UI
It is designed to be theno-nonsense, cheap, and secure alternative toservices that require access to your code and force your app to fit withintheir specific deployment system and/or require a specific config file.
- Product Owners: Interact with a new feature as it's built, give valuable feedback earlier, reduce wasted development time.
- Developers: Show your work in progress, find bugs early, deliver the right feature.
- Ops: Concentrate on high value tasks, not maintaining staging environments.
- CTOs: Don't let your code run on third-party servers: your code always stays private on either GitHub's or your servers.
Preview environments that:
work with yourexisting tooling: If your app can be started withdocker-compose, it can be deployed to preview environments with PullPreview.
can bestarted and destroyed easily: You can manage preview environmentsby adding or removing the
pullpreview
label on your Pull Requests. You canset specific branches as always on, for instance to continuously deploy yourmaster branch.arecheap too run: Preview environments are launched on AWS Lightsailinstances, which are both very cheap (10USD per month, proratized to theduration of the PR), and all costs included (bandwith, storage, etc.)
take theprivacy of your code seriously: The workflow happens all withina GitHub Action, which means your code never leaves GitHub or your Lightsailinstances.
make the preview URLeasy to find for your reviewers: Deployment statusesand URLs are visible in the PR checks section, and on the Deployments tab inthe GitHub UI.
persist state across deploys: Any state stored in docker volumes (e.g.database data) will be persisted across deploys, making the life of reviewerseasier.
areeasy to troubleshoot: You can give specific GitHub users theauthorization to SSH into the preview instance (with sudo privileges) tofurther troubleshoot any issue. The SSH keys that they use to push to GitHubwill automatically be installed on the preview servers.
areintegrated into the GitHub UI: Logs for each deployment run areavailable within the Actions section, and direct links to the previewenvironments are available in the Checks section of a PR, and in theDeployments tab of the repository.
- Getting Started
- ActionInputs /Outputs
- HandlingSeed Data
- Workflow Examples
- FAQ
→ Please see thewiki for the full documentation.
Workflow file with themaster
branch always on:
# .github/workflows/pullpreview.ymlname:PullPreviewon:# the schedule is optional, but helps to make sure no dangling resources are left when GitHub Action does not behave properlyschedule: -cron:"30 2 * * *"push:branches: -mainpull_request:types:[labeled, unlabeled, synchronize, closed, reopened]jobs:deploy:if:github.event_name == 'schedule' || github.event_name == 'push' || github.event.label.name == 'pullpreview' || contains(github.event.pull_request.labels.*.name, 'pullpreview')runs-on:ubuntu-latesttimeout-minutes:30steps: -uses:actions/checkout@v4 -uses:pullpreview/action@v5with:# Those GitHub users will have SSH access to the serversadmins:crohr,other-github-user# A preview environment will always exist for the main branchalways_on:main# Use the cidrs option to restrict access to the live environments to specific IP rangescidrs:"0.0.0.0/0"# PullPreview will use those 2 files when running docker-compose upcompose_files:docker-compose.yml,docker-compose.pullpreview.yml# The preview URL will target this portdefault_port:80# Use a 512MB RAM instance type instead of the default 2GBinstance_type:nano# Ports to open on the serverports:80,5432env:AWS_ACCESS_KEY_ID:"${{ secrets.AWS_ACCESS_KEY_ID }}"AWS_SECRET_ACCESS_KEY:"${{ secrets.AWS_SECRET_ACCESS_KEY }}"AWS_REGION:"us-east-1"
The code for this Action is completely open source, and licensed under theProsperity Public License (see LICENSE).
If you are a non-profit individual, then it is free to run (in that case, please tell meso and/or pass the word around!).
In all other cases, you must buy a license. More details onpullpreview.com.
Thanks for reading until the end!
About
A GitHub Action that starts preview deployments for your pull requests and branches. It can work with any application that has a valid Docker Compose file.