Skip to content

Easily get started with Preview Environments using this minimal template

License

Notifications You must be signed in to change notification settings

famly/template-preview-environment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Template: Preview Environments

I’d really like to take this feature/change for a spin, but it’s so much work spinning up an environment just for that! 😩 - Sincerely, Everyone.

Haven’t we all been there before? Well, no more! By sprinkling a little pixie dust onto your CI, we can make it possible to spin up an entire preview environment on-the-go, to test out all your changes 🙂

The quick version?

  • Comment /preview on a Pull Request to start an ephemeral Preview Environment
  • This will stay up for 30 minutes by default, but you can change that in the workflow file

We use the expose-tunnel action to easily set up a tunnel into the CI job. It creates a tunnel using bore.pub, which supports setting up your own self-hosted server.

Check out the examples here:

  • Example Pull Request that starts a Preview Environment #1
  • Example CI job output here

Workflow Overview

The following diagram is an overview of the flow the CI job:

            Comment posted on Pull Request
                          ↓
            +----------------------------+
            |   Detect Trigger Comment   |
            |   React with 👀 if it is   |
            +----------------------------+
                          ↓
            +----------------------------+
            |      Checkout PR Code      |
            +----------------------------+
                          ↓
            +----------------------------+
            | Setup Project Dependencies |
            +----------------------------+
                          ↓
            +----------------------------+
            |  Start Development Server  |
            |       in background        |
            +----------------------------+
                          ↓
            +----------------------------+
            |  Setup Tunnel into CI Job  |
            +----------------------------+
                          ↓
            +----------------------------+
            | Post Tunnel URL as Comment |
            |    on the Pull Request     |
            +----------------------------+
                          ↓
            +----------------------------+
            | Keep CI/Server alive for   |
            |        30 minutes          |
            +----------------------------+

About

Easily get started with Preview Environments using this minimal template

Topics

Resources

License

Stars

Watchers

Forks