Added optional coolify installation and configurable auto reboot and … #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy to VPS | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Deploy to VPS | |
| uses: appleboy/ssh-action@master | |
| env: | |
| NEW_USER: ${{ secrets.VPS_USER }} | |
| NEW_USER_PASSWORD: ${{ secrets.VPS_USER_PASSWORD }} | |
| SSH_PUBLIC_KEY: ${{ secrets.SSH_PUBLIC_KEY }} | |
| INSTALL_COOLIFY: ${{ secrets.INSTALL_COOLIFY }} | |
| AUTO_REBOOT: ${{ secrets.AUTO_REBOOT }} | |
| REMOVE_UNUSED_DEPS: ${{ secrets.REMOVE_UNUSED_DEPS }} | |
| with: | |
| host: ${{ secrets.VPS_HOST }} | |
| username: root | |
| password: ${{ secrets.VPS_ROOT_PASSWORD }} | |
| envs: NEW_USER,NEW_USER_PASSWORD,SSH_PUBLIC_KEY,INSTALL_COOLIFY,AUTO_REBOOT,REMOVE_UNUSED_DEPS | |
| script: | | |
| TEMP_DIR=$(mktemp -d) | |
| cd $TEMP_DIR | |
| cat > setup.sh << 'EOL' | |
| ${{ github.workspace }}/setup.sh | |
| EOL | |
| chmod +x setup.sh | |
| ./setup.sh | |
| cd / | |
| rm -rf $TEMP_DIR | |
| - name: Post-setup instructions | |
| run: | | |
| echo "🎉 Setup completed!" | |
| echo "⚠️ IMPORTANT: After verifying SSH key access works, disable password authentication:" | |
| echo "ssh ${{ secrets.VPS_USER }}@${{ secrets.VPS_HOST }} 'sudo sed -i \"s/PasswordAuthentication yes/PasswordAuthentication no/\" /etc/ssh/sshd_config && sudo systemctl restart sshd'" | |
| if [ "${INSTALL_COOLIFY}" = "true" ]; then | |
| echo "⚠️ After configuring your domain in Coolify, remove temporary ports:" | |
| echo "ssh $NEW_USER@<your-vps-ip> 'sudo ufw delete allow 8000/tcp && sudo ufw delete allow 6001/tcp && sudo ufw delete allow 6002/tcp'" | |
| fi |