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

This commit is contained in:
2025-09-06 18:58:04 +10:00
parent cc46db0cb3
commit f191fe9e4a

View File

@ -40,39 +40,39 @@ jobs:
build-args: | build-args: |
HUGO_BASEURL=https://comprofix.com/ HUGO_BASEURL=https://comprofix.com/
deploy: deploy:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: build-and-push needs: build-and-push
env: env:
DEPLOY_USER: administrator DEPLOY_USER: administrator
DEPLOY_HOST: docker.comprofix.xyz DEPLOY_HOST: docker.comprofix.xyz
DEPLOY_PATH: /opt/comprofix DEPLOY_PATH: /opt/comprofix
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Deploy to production server - name: Deploy to production server
run: | run: |
mkdir -p ~/.ssh mkdir -p ~/.ssh
eval $(ssh-agent -s) eval $(ssh-agent -s)
ssh-add <(echo "${{ secrets.SSH_PRIVATE_KEY }}") ssh-add <(echo "${{ secrets.SSH_PRIVATE_KEY }}")
echo "Host *" > ~/.ssh/config echo "Host *" > ~/.ssh/config
echo "StrictHostKeyChecking no" >> ~/.ssh/config echo "StrictHostKeyChecking no" >> ~/.ssh/config
echo "Uploading docker-compose.yml and .env.production..." echo "Uploading docker-compose.yml and .env.production..."
scp docker-compose.yml $DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH scp docker-compose.yml $DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH
scp .env.production $DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH/.env.production scp .env.production $DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH/.env.production
echo "Deploying production container..." echo "Deploying production container..."
ssh -o StrictHostKeyChecking=no $DEPLOY_USER@$DEPLOY_HOST " ssh -o StrictHostKeyChecking=no $DEPLOY_USER@$DEPLOY_HOST "
cd $DEPLOY_PATH cd $DEPLOY_PATH
# Extract Git tag that triggered the workflow # Extract Git tag that triggered the workflow
VERSION=\${GITHUB_REF#refs/tags/} VERSION=\${GITHUB_REF#refs/tags/}
# Update IMAGE_TAG in .env.production # Update IMAGE_TAG in .env.production
sed -i 's/^IMAGE_TAG=.*/IMAGE_TAG=\$VERSION/' .env.production sed -i 's/^IMAGE_TAG=.*/IMAGE_TAG=\$VERSION/' .env.production
# Stop old container, pull new image, start container # Stop old container, pull new image, start container
docker compose --env-file .env.production down --remove-orphans docker compose --env-file .env.production down --remove-orphans
docker compose --env-file .env.production pull docker compose --env-file .env.production pull
docker compose --env-file .env.production up -d docker compose --env-file .env.production up -d
" "