Participant epic #11
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: 'remove-preview' | |
# yamllint disable-line rule:truthy | |
on: | |
# only run this workflow on pull request events | |
pull_request: | |
types: | |
- closed | |
jobs: | |
destroy_review_app: | |
runs-on: ubuntu-latest | |
environment: preview | |
concurrency: preview | |
# only run when a pull request is closed | |
#if: github.event_name == 'pull_request' && github.event.action == 'closed' | |
steps: | |
- name: Destroy the review app | |
uses: dokku/github-action@master | |
with: | |
branch: 'main' | |
# destroy a review app | |
command: review-apps:destroy | |
git_remote_url: 'ssh://dokku@167.235.152.70:22/certificates' | |
# specify a name for the review app | |
review_app_name: pre-${{ github.event.pull_request.number }} | |
ssh_private_key: ${{ secrets.SSH_KEY_SIR }} | |
- name: Destroy review database | |
# see https://blog.benoitblanchon.fr/github-action-run-ssh-commands/ | |
run: | | |
mkdir -p ~/.ssh/ | |
echo "$SSH_KEY" > ~/.ssh/preview.key | |
chmod 600 ~/.ssh/preview.key | |
cat >>~/.ssh/config <<END | |
Host preview | |
HostName $SSH_HOST | |
User $SSH_USER | |
IdentityFile ~/.ssh/preview.key | |
StrictHostKeyChecking no | |
END | |
ssh -t preview "postgres:destroy ${REVIEW_APP_NAME}-db --force" | |
env: | |
SSH_USER: dokku | |
SSH_KEY: ${{ secrets.SSH_KEY_SIR }} | |
SSH_HOST: 167.235.152.70 | |
REVIEW_APP_NAME: pre-${{ github.event.pull_request.number }} |