-
Notifications
You must be signed in to change notification settings - Fork 15
Deploying multiple preview environments per pull request
Cyril Rohr edited this page Nov 23, 2023
·
6 revisions
If you require multiple preview environments for a single pull request, you can specify multiple jobs in your workflow, and name each environment with a deployment_variant
option (limited to 4 characters maximum):
name: pullpreview_multi_env
on:
schedule:
- cron: "45 0 * * *"
pull_request:
types: [labeled, unlabeled, synchronize, closed, reopened]
jobs:
deploy_env1:
runs-on: ubuntu-latest
if: github.event_name == 'schedule' || github.event_name == 'push' || github.event.label.name == 'pullpreview-multi-env' || contains(github.event.pull_request.labels.*.name, 'pullpreview-multi-env')
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- uses: pullpreview/action@v5
with:
deployment_variant: env1
label: pullpreview-multi-env
admins: crohr
app_path: ./examples/wordpress
instance_type: micro
registries: docker://${{ secrets.GHCR_PAT }}@ghcr.io
env:
AWS_ACCESS_KEY_ID: "${{ secrets.AWS_ACCESS_KEY_ID }}"
AWS_SECRET_ACCESS_KEY: "${{ secrets.AWS_SECRET_ACCESS_KEY }}"
deploy_env2:
runs-on: ubuntu-latest
if: github.event_name == 'schedule' || github.event_name == 'push' || github.event.label.name == 'pullpreview-multi-env' || contains(github.event.pull_request.labels.*.name, 'pullpreview-multi-env')
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- uses: pullpreview/action@v5
with:
deployment_variant: env2
label: pullpreview-multi-env
admins: crohr
app_path: ./examples/wordpress
instance_type: micro
registries: docker://${{ secrets.GHCR_PAT }}@ghcr.io
env:
AWS_ACCESS_KEY_ID: "${{ secrets.AWS_ACCESS_KEY_ID }}"
AWS_SECRET_ACCESS_KEY: "${{ secrets.AWS_SECRET_ACCESS_KEY }}"
Note that you can also choose to deploy another repository using this feature (e.g. an API backend accompanied by its SPA frontend).