Skip to content

livecycle/preevy-down-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deploy preview environment using preevy

About Preevy

Preevy is a powerful CLI tool designed to simplify the process of creating ephemeral preview environments. Using Preevy, you can easily provision any Docker Compose application using any Kubernetes server or affordable VMs on AWS Lightsail, Google Cloud or Azure VM.

Visit The full documentation here: https://preevy.dev/

About the preevy-down action

Use this action to delete a preview environment using the Preevy CLI whenever a PR is merged or closed. More information about running Preevy from CI over here.

Preevy's GitHub plugin will automatically update the comment generated by the "up" workflow to indicate the environment was deleted.

See the preevy-up action for more information and examples.

Permissions

Preevy requires the following GitHub Actions permissions:

  • contents: read: used by Preevy to read the Docker Compose file(s)
  • pull-requests: write: used by the Preevy GitHub plugin to write or update a comment on the PR

In addition, if you're using GitHub's OIDC Token endpoint to authenticate to your cloud provider (as in the below examples), id-token: write: is also needed.

Inputs

profile-url

required: true

The profile url created by the CLI, as detailed in the docs.

args

required: false

Optional additional args to the preevy down command. Full reference.

version

required: false

The preevy CLI version to use. Defaults to latest.

Note Since v1.3.0, this action requires Preevy CLI version v0.0.58 or newer. To use an older version of the CLI, use livecycle/preevy-down-action@v1.2.0.

docker-compose-yaml-paths

required: false

Optional path to the docker-compose.yaml file. If not provided, uses the working directory. If you have multiple docker compose files, you can add them as a comma seperated string like so 'docker-compose.yml,docker-compose.dev.yml'

install

required: false

EXPERIMENTAL. Installation method for the Preevy CLI. Specify gh-release to install Preevy from a binary file, which is much faster than using NPM. Specify none to skip the installation steps. The default is npm which will install from NPM.

If gh-release is specified, version can be either latest or one of the released versions. Canary versions are not supported.

node-cache

required: false

Node package manager used for caching. Supported values: npm, yarn, pnpm, or ''. Details. Default: npm.

working-directory

required: false

Specifies the working directory where the Preevy CLI is run

Example usage

name: Teardown Preevy environment
on:
  pull_request:
    types:
      - closed
permissions:
  id-token: write
  contents: read

  # needed to update the PR comment with the environment URLs
  pull-requests: write
jobs:
  teardown:
    runs-on: ubuntu-latest
    steps:
      - uses: aws-actions/configure-aws-credentials@v2
        with:
          role-to-assume: arn:aws:iam::12345678:role/my-role
          aws-region: eu-west-1

      - uses: actions/checkout@v3
      - uses: livecycle/preevy-down-action@v1.3.0
        id: preevy
        with:
          # Create the profile using the `preevy init` command, see https://preevy.dev/ci
          profile-url: "s3://preevy-12345678-my-profile?region=eu-west-1"
          docker-compose-yaml-paths: "./docker/docker-compose.yaml"