refactor-#4214(ui): clean up imports and adjust search input #7
This file contains 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: Staging Deployment | |
on: | |
push: | |
branches: | |
- develop | |
jobs: | |
deploy-to-staging: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 # Updated to the latest version | |
- name: Install SSH Key | |
uses: webfactory/[email protected] # Updated to the latest version | |
with: | |
ssh-private-key: ${{ secrets.STAGING_SSH_PRIVATE_KEY }} | |
- name: Upload Environment Variables | |
run: | | |
ssh -o StrictHostKeyChecking=no ${{ secrets.STAGING_SSH_USER }}@${{ secrets.STAGING_VPS_IP }} << 'EOF' | |
echo "${{ secrets.STAGING_FRONTEND_ENV }}" | sudo tee ${{ secrets.PROJECT_PATH }}/.env.production > /dev/null || { echo "Failed to create .env.production file"; exit 1; } | |
EOF | |
- name: Copy Files to VPS | |
run: | | |
rsync -avz -e "ssh -o StrictHostKeyChecking=no" \ | |
--exclude='.git' \ | |
--exclude='.github' \ | |
--exclude='node_modules' \ | |
--exclude='.next' \ | |
. ${{ secrets.STAGING_SSH_USER }}@${{ secrets.STAGING_VPS_IP }}:${{ secrets.PROJECT_PATH }} | |
- name: Run Deployment Script on VPS | |
run: | | |
ssh -o StrictHostKeyChecking=no ${{ secrets.STAGING_SSH_USER }}@${{ secrets.STAGING_VPS_IP }} << 'ENDSSH' | |
# Source profile files to get environment variables and PATH | |
source ~/.bashrc | |
source ~/.profile | |
# Ensure NVM is loaded | |
export NVM_DIR="$HOME/.nvm" | |
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" | |
# Explicitly set PROJECT_PATH | |
export PROJECT_PATH="${{ secrets.PROJECT_PATH }}" | |
# Verify PROJECT_PATH is set | |
if [ -z "$PROJECT_PATH" ]; then | |
echo "ERROR: PROJECT_PATH is not set" | |
exit 1 | |
fi | |
# Navigate to the project directory | |
cd $PROJECT_PATH | |
# Make the start script executable | |
chmod +x start.sh | |
# Now run the start script | |
./start.sh | |
EOF |