5 Commits

Author SHA1 Message Date
6cb3699016 fix: update to deploy on correct location
All checks were successful
Build and Deploy Production / build-and-push (push) Successful in 2m9s
Build and Deploy Production / deploy (push) Successful in 15s
2025-09-06 19:20:30 +10:00
2734dd8c58 fix: update to deploy on correct location
Some checks failed
Build and Deploy Production / build-and-push (push) Successful in 2m6s
Build and Deploy Production / deploy (push) Failing after 11s
2025-09-06 19:06:09 +10:00
f191fe9e4a fix: formatting so deploy runs
Some checks failed
Build and Deploy Production / build-and-push (push) Successful in 2m6s
Build and Deploy Production / deploy (push) Failing after 4s
2025-09-06 18:58:04 +10:00
cc46db0cb3 chore: update for production run
All checks were successful
Build and Deploy Production / build-and-push (push) Successful in 2m8s
2025-09-06 18:55:08 +10:00
c0e2a1c1f4 chore: update for host 2025-09-06 18:53:52 +10:00

View File

@ -3,7 +3,7 @@ name: Build and Deploy Production
on:
push:
tags:
- "v*.*.*"
- "v*"
jobs:
build-and-push:
@ -47,6 +47,7 @@ jobs:
DEPLOY_USER: administrator
DEPLOY_HOST: docker.comprofix.xyz
DEPLOY_PATH: /opt/comprofix
VERSION: ${{ github.ref_name }} # <-- get the tag that triggered this workflow
steps:
- uses: actions/checkout@v4
@ -55,22 +56,21 @@ jobs:
mkdir -p ~/.ssh
eval $(ssh-agent -s)
ssh-add <(echo "${{ secrets.SSH_PRIVATE_KEY }}")
echo "HOST *" > ~/.ssh/config
echo "Host *" > ~/.ssh/config
echo "StrictHostKeyChecking no" >> ~/.ssh/config
echo "nameserver 10.10.10.1" > /etc/resolv.conf
echo "Uploading docker-compose.yml and .env.production..."
scp docker-compose.yml $DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH
# Replace IMAGE_TAG in .env.production with the current VERSION
sed "s/^IMAGE_TAG=.*/IMAGE_TAG=${{ env.VERSION }}/" .env.production > .env.production.new
scp .env.production.new $DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH/.env.production
scp .env.production $DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH/.env.production
echo "Deploying production container..."
ssh -o StrictHostKeyChecking=no $DEPLOY_USER@$DEPLOY_HOST "
cd $DEPLOY_PATH
# Replace IMAGE_TAG with the version from CI
sed -i 's/^IMAGE_TAG=.*/IMAGE_TAG=${VERSION}/' .env.production
# Stop old container, pull new image, start container
docker compose --env-file .env.production down --remove-orphans
docker compose --env-file .env.production pull --ignore-pull-failures
docker compose --env-file .env.production pull
docker compose --env-file .env.production up -d
"