diff --git a/.github/workflows/deploy_production.yaml b/.github/workflows/deploy_production.yaml index aafd99f..058d43d 100644 --- a/.github/workflows/deploy_production.yaml +++ b/.github/workflows/deploy_production.yaml @@ -33,11 +33,15 @@ jobs: - name: Build the binary run: make build SUFFIX=-production-$GITHUB_SHA + - name: Build the migration binary + run: make migrate SUFFIX=-production-$GITHUB_SHA + - name: Deploy to Server env: USER: deploy HOST: projectreshoot.com DIR: /home/deploy/releases/production + MIG_DIR: /home/deploy/migration-bin DEPLOY_SSH_PRIVATE_KEY: ${{ secrets.DEPLOY_SSH_PRIVATE_KEY }} run: | mkdir -p ~/.ssh @@ -49,7 +53,13 @@ jobs: echo " UserKnownHostsFile /dev/null" >> ~/.ssh/config ssh -i ~/.ssh/id_ed25519 $USER@$HOST mkdir -p $DIR - scp -i ~/.ssh/id_ed25519 projectreshoot-production-${GITHUB_SHA} $USER@$HOST:$DIR - ssh -i ~/.ssh/id_ed25519 $USER@$HOST 'bash -s' < ./deploy/deploy_production.sh $GITHUB_SHA + ssh -i ~/.ssh/id_ed25519 $USER@$HOST mkdir -p $MIG_DIR + scp -i ~/.ssh/id_ed25519 prmigrate-production-${GITHUB_SHA} $USER@$HOST:$MIG_DIR + + scp -i ~/.ssh/id_ed25519 ./deploy/db/backup.sh $USER@$HOST:$MIG_DIR + scp -i ~/.ssh/id_ed25519 ./deploy/db/migrate.sh $USER@$HOST:$MIG_DIR + scp -i ~/.ssh/id_ed25519 ./deploy/db/migrationcleanup.sh $USER@$HOST:$MIG_DIR + + ssh -i ~/.ssh/id_ed25519 $USER@$HOST 'bash -s' < ./deploy/deploy.sh $GITHUB_SHA production