Update CI for Dokku

This commit is contained in:
Christopher C. Wells 2022-10-29 19:19:04 -07:00
parent 65a7e8776c
commit a6c1e2cb38
2 changed files with 47 additions and 0 deletions

View File

@ -1,4 +1,6 @@
name: CI
env:
DOKKU_GIT_REMOTE_URL: 'ssh://dokku@dokku.baby-buddy.net:22/demo'
on:
push:
branches:
@ -36,6 +38,32 @@ jobs:
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true
deploy-review-app:
needs: test
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && github.event.action == 'opened'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Push to dokku
uses: dokku/github-action@master
with:
command: review-apps:create
git_remote_url: ${{ env.DOKKU_GIT_REMOTE_URL }}
review_app_name: pr-${{ github.event.pull_request.number }}
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
destroy-review-app:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && github.event.action == 'closed'
steps:
- name: Destroy the review app
uses: dokku/github-action@master
with:
command: review-apps:destroy
git_remote_url: ${{ env.DOKKU_GIT_REMOTE_URL }}
review_app_name: pr-${{ github.event.pull_request.number }}
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
deploy-docs:
needs: test
runs-on: ubuntu-latest
@ -50,3 +78,16 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
REQUIREMENTS: docs/requirements.txt
deploy-demo:
needs: test
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Push to dokku
uses: dokku/github-action@master
with:
git_remote_url: ${{ env.DOKKU_GIT_REMOTE_URL }}
ssh_private_key: ${{ secrets.DOKKU_SSH_PRIVATE_KEY }}

6
bin/ci-pre-deploy Normal file
View File

@ -0,0 +1,6 @@
#!/bin/sh -l
if [ "$IS_REVIEW_APP" = "true" ]; then
ssh "$SSH_REMOTE" -- config:set "$APP_NAME" "DOMAIN=$APP_NAME.dokku.baby-buddy.net"
echo "configured the review app domain"
fi