mybuddy/.github/workflows/review-app.yml

54 lines
1.9 KiB
YAML
Raw Normal View History

2022-11-05 20:52:01 +00:00
name: "Review app"
env:
DOKKU_GIT_REMOTE_URL: 'ssh://dokku@dokku.baby-buddy.net:22'
on:
pull_request:
types: [labeled, unlabeled]
jobs:
2022-11-06 04:28:41 +00:00
dump-contexts-to-log:
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
id: github_context_step
run: echo '${{ toJSON(github) }}'
- name: Dump job context
run: echo '${{ toJSON(job) }}'
- name: Dump steps context
run: echo '${{ toJSON(steps) }}'
2022-11-05 20:52:01 +00:00
create-review-app:
runs-on: ubuntu-latest
2022-11-05 23:48:00 +00:00
environment:
name: pr-${{ github.event.pull_request.number }}
url: https://pr-${{ github.event.pull_request.number }}.dokku.baby-buddy.net
if: github.event_name == 'labeled' && github.event.label.name == 'to review'
2022-11-05 20:52:01 +00:00
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Create review app
uses: dokku/github-action@master
with:
command: review-apps:create
git_remote_url: ${{ env.DOKKU_GIT_REMOTE_URL }}/demo
review_app_name: pr-${{ github.event.pull_request.number }}
ssh_private_key: ${{ secrets.DOKKU_SSH_PRIVATE_KEY }}
destroy-review-app:
runs-on: ubuntu-latest
2022-11-05 23:48:00 +00:00
environment:
name: pr-${{ github.event.pull_request.number }}
url: https://pr-${{ github.event.pull_request.number }}.dokku.baby-buddy.net
if: github.event_name == 'unlabeled' && github.event.label.name == 'to review'
2022-11-05 20:52:01 +00:00
steps:
- name: Destroy review app
uses: dokku/github-action@master
with:
command: review-apps:destroy
git_remote_url: ${{ env.DOKKU_GIT_REMOTE_URL }}/demo
review_app_name: pr-${{ github.event.pull_request.number }}
ssh_private_key: ${{ secrets.DOKKU_SSH_PRIVATE_KEY }}
2022-11-05 23:48:00 +00:00
- name: Delete environment
uses: strumwolf/delete-deployment-environment@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
environment: pr-${{ github.event.pull_request.number }}