Files
comprofix.com/.gitea/workflows/develop.yml
Matthew McKinnon c4bd7bac2d
Some checks failed
Build and Deploy Development / build-and-push (push) Successful in 1m4s
Build and Deploy Development / deploy (push) Failing after 10s
fix: update workflow yml
2025-09-06 15:23:06 +10:00

62 lines
1.7 KiB
YAML

name: Build and Deploy Development
on:
push:
branches:
- develop
jobs:
build-and-push:
runs-on: ubuntu-latest
container:
image: catthehacker/ubuntu:act-latest
env:
DOCKER_REGISTRY: git.comprofix.com
IMAGE_NAME: mmckinnon/comprofix.com
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:develop
build-args: |
HUGO_BASEURL=https://dev.comprofix.com/
deploy:
runs-on: ubuntu-latest
needs: build-and-push
env:
DEPLOY_USER: administrator
DEPLOY_HOST: docker.comprofix.xyz
DEPLOY_PATH: /opt/comprofix
steps:
- uses: actions/checkout@v4
- name: Deploy to development server
run: |
mkdir -p ~/.ssh
eval $(ssh-agent -s)
ssh-add <(echo "${{ secrets.SSH_PRIVATE_KEY }}")
echo "Uploading docker-compose.yml and .env.develop..."
scp docker-compose.yml $DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH
scp .env.develop $DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH/.env
echo "Deploying development container..."
ssh -o StrictHostKeyChecking=no $DEPLOY_USER@$DEPLOY_HOST "
cd $DEPLOY_PATH
docker compose --env-file .env up -d
"