livecycle / preevy-gha-gce-demo

Demo: Preevy + GitHub Actions + Google Cloud

Home Page:https://preevy.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Preevy + GitHub Actions + Google Cloud VMs

Action

This repo demonstrates deploying a Preevy environment per pull request. It also shows integration with GitHub deployments and environments.

For every PR opened or updated:

PR comment

  • A GH environment will be created (named pr-NNN, where NNN is the PR number) and shown on the repo main page.

GH Environment

When the PR is closed

  • Preevy will delete the GCE VM.
  • The PR comment will be updated to reflect the fact that the Preevy environment no longer exists.

updated PR comment

  • The GH environment will be deleted (optional, see below).

To use the workflow:

Optional: Delete GH deployments and environments on PR closure

To delete GH deployments and environments on PR closure, you need to setup a private GH App which will be used by the GHA flows. This is beacuse the default GITHUB_TOKEN does not have enough permissions to delete those resources.

To disable this feature, remove the last steps of the preevy_down.yaml workflow as documented in the file itself. You will have to remove the environments manually from the repo's "Environments" page.

After setting up the GH app:

  • Set the GHA secret GH_APP_PRIVATE_KEY to the app private key.
  • Set the GHA var GH_APP_ID to the app id.
  • Install the app at the repo.

Demo app

The demo Compose app in this repo is taken from the react-express-mysql sample Compose app from the Awesome Compose project by Docker. See the app README for details.

About

Demo: Preevy + GitHub Actions + Google Cloud

https://preevy.dev


Languages

Language:JavaScript 70.2%Language:Dockerfile 13.0%Language:HTML 11.2%Language:CSS 5.6%