feat: copy docker-compose.pod to server
This commit is contained in:
parent
d321fd8f80
commit
1d671300f5
|
|
@ -68,18 +68,28 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
- name: Checkout deploy files
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Upload Docker Compose file
|
||||||
|
uses: appleboy/scp-action@v0.1.7
|
||||||
|
with:
|
||||||
|
host: ${{ secrets.SSH_HOST }}
|
||||||
|
username: ${{ secrets.SSH_USER }}
|
||||||
|
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||||
|
source: docker-compose.prod.yml
|
||||||
|
target: ${{ secrets.DEPLOY_PATH || '/opt/bemeal' }}
|
||||||
|
|
||||||
- name: Deploy via SSH (Blue/Green)
|
- name: Deploy via SSH (Blue/Green)
|
||||||
uses: appleboy/ssh-action@v1.0.3
|
uses: appleboy/ssh-action@v1.0.3
|
||||||
env:
|
env:
|
||||||
IMAGE_TAG: ${{ github.sha }}
|
IMAGE_TAG: ${{ github.sha }}
|
||||||
DEPLOY_PATH: ${{ secrets.DEPLOY_PATH }}
|
DEPLOY_PATH: ${{ secrets.DEPLOY_PATH }}
|
||||||
REGISTRY_USERNAME: ${{ github.actor }}
|
|
||||||
REGISTRY_PASSWORD: ${{ secrets.TOKEN_GITEA }}
|
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.SSH_HOST }}
|
host: ${{ secrets.SSH_HOST }}
|
||||||
username: ${{ secrets.SSH_USER }}
|
username: ${{ secrets.SSH_USER }}
|
||||||
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||||
envs: REGISTRY,IMAGE_NAME,IMAGE_TAG,DEPLOY_PATH,REGISTRY_USERNAME,REGISTRY_PASSWORD
|
envs: REGISTRY,IMAGE_NAME,IMAGE_TAG,DEPLOY_PATH
|
||||||
script: |
|
script: |
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
|
|
@ -95,10 +105,18 @@ jobs:
|
||||||
SUDO="sudo"
|
SUDO="sudo"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ ! -d "$APP_DIR" ]; then
|
||||||
|
echo "Missing deploy directory: $APP_DIR"
|
||||||
|
echo "Set the DEPLOY_PATH secret to the directory containing $COMPOSE_FILE."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
cd "$APP_DIR"
|
cd "$APP_DIR"
|
||||||
|
|
||||||
if [ -n "${REGISTRY_PASSWORD:-}" ]; then
|
if [ ! -f "$COMPOSE_FILE" ]; then
|
||||||
echo "$REGISTRY_PASSWORD" | docker login "$REGISTRY" -u "$REGISTRY_USERNAME" --password-stdin
|
echo "Missing $APP_DIR/$COMPOSE_FILE"
|
||||||
|
echo "Set the DEPLOY_PATH secret to the directory containing $COMPOSE_FILE, or copy the compose file there."
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$COMPOSE_ENV_FILE" ]; then
|
if [ -f "$COMPOSE_ENV_FILE" ]; then
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue