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 Production | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - main | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up SSH | |
| uses: webfactory/[email protected] | |
| with: | |
| ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
| - name: Add server to known hosts | |
| run: | | |
| mkdir -p ~/.ssh | |
| ssh-keyscan -H profullstack.com >> ~/.ssh/known_hosts | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y rsync | |
| - name: Create .env file from secret | |
| run: | | |
| # Create .env file from GitHub secret | |
| echo "${{ secrets.ENV_FILE_CONTENT }}" > .env | |
| # Print confirmation (without showing the content for security) | |
| echo "Created .env file with $(grep -c '' .env) lines" | |
| - name: Deploy to server | |
| run: | | |
| # Make deploy script executable | |
| chmod +x ./bin/deploy.sh | |
| # Print debug info | |
| echo "Current directory: $(pwd)" | |
| echo "Files in bin directory:" | |
| ls -la ./bin | |
| # Run deploy script with full hostname | |
| DEPLOY_REMOTE_HOST=profullstack.com ./bin/deploy.sh | |
| # Run test script to verify deployment | |
| echo "Running test script on remote server..." | |
| ssh profullstack.com "cd $DEPLOY_REMOTE_DIR && chmod +x bin/test-github-actions.sh && ./bin/test-github-actions.sh" | |
| env: | |
| DEPLOY_REMOTE_HOST: profullstack.com | |
| DEPLOY_REMOTE_DIR: www/profullstack.com/pdf | |
| INSTALL_SERVICE: true |