feat: add dev and prod deployment scaffolding
This commit is contained in:
33
.github/workflows/deploy-prod.yml
vendored
Normal file
33
.github/workflows/deploy-prod.yml
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
name: Deploy Production
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: deploy-prod
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
environment: production
|
||||
steps:
|
||||
- name: Deploy over SSH
|
||||
uses: appleboy/ssh-action@v1.2.0
|
||||
with:
|
||||
host: ${{ secrets.PROD_DEPLOY_HOST }}
|
||||
username: ${{ secrets.PROD_DEPLOY_USER }}
|
||||
key: ${{ secrets.PROD_DEPLOY_SSH_KEY }}
|
||||
port: ${{ secrets.PROD_DEPLOY_PORT || 22 }}
|
||||
script: |
|
||||
set -e
|
||||
REPO_URL="git@github.com:${{ github.repository }}.git"
|
||||
DEPLOY_DIR="${{ secrets.PROD_DEPLOY_PATH }}"
|
||||
if [ ! -d "$DEPLOY_DIR/.git" ]; then
|
||||
git clone "$REPO_URL" "$DEPLOY_DIR"
|
||||
fi
|
||||
cd "$DEPLOY_DIR"
|
||||
git fetch --all --prune
|
||||
git checkout main || git checkout -b main origin/main
|
||||
git reset --hard origin/main
|
||||
RUN_DJANGO_CHECK=1 ./scripts/deploy_stack.sh .env.prod docker-compose.prod.yml
|
||||
36
.github/workflows/deploy-test.yml
vendored
Normal file
36
.github/workflows/deploy-test.yml
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
name: Deploy Test
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
|
||||
concurrency:
|
||||
group: deploy-test-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
environment: development
|
||||
steps:
|
||||
- name: Deploy over SSH
|
||||
uses: appleboy/ssh-action@v1.2.0
|
||||
with:
|
||||
host: ${{ secrets.TEST_DEPLOY_HOST }}
|
||||
username: ${{ secrets.TEST_DEPLOY_USER }}
|
||||
key: ${{ secrets.TEST_DEPLOY_SSH_KEY }}
|
||||
port: ${{ secrets.TEST_DEPLOY_PORT || 22 }}
|
||||
script: |
|
||||
set -e
|
||||
REPO_URL="git@github.com:${{ github.repository }}.git"
|
||||
DEPLOY_DIR="${{ secrets.TEST_DEPLOY_PATH }}"
|
||||
if [ ! -d "$DEPLOY_DIR/.git" ]; then
|
||||
git clone "$REPO_URL" "$DEPLOY_DIR"
|
||||
fi
|
||||
cd "$DEPLOY_DIR"
|
||||
git fetch --all --prune
|
||||
git checkout develop || git checkout -b develop origin/develop
|
||||
git reset --hard ${{ github.sha }}
|
||||
RUN_DJANGO_CHECK=0 DEPLOY_HEALTH_URL="http://127.0.0.1:8088/healthz/" ./scripts/deploy_stack.sh .env.test docker-compose.prod.yml
|
||||
Reference in New Issue
Block a user