@@ -24,13 +24,31 @@ This repository is configured to automatically deploy to the production server w
2424 ssh ubuntu@profullstack " echo 'your-public-key-here' >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"
2525 ```
2626
27- 3 . ** Add the private key to GitHub Secrets ** :
27+ 3 . ** Add the required secrets to GitHub** :
2828 - Go to your GitHub repository
2929 - Click on "Settings" > "Secrets and variables" > "Actions"
30+ - Add the following secrets:
31+
32+ a. ** SSH Private Key** :
3033 - Click "New repository secret"
3134 - Name: ` SSH_PRIVATE_KEY `
3235 - Value: Copy the entire content of your private key file (` ~/.ssh/id_ed25519 ` )
3336 - Click "Add secret"
37+
38+ b. ** Environment Variables** :
39+ - Click "New repository secret"
40+ - Name: ` ENV_FILE_CONTENT `
41+ - Value: Copy the entire content of your .env file
42+ - Click "Add secret"
43+
44+ 4 . ** Important Note About SSH Configuration** :
45+ - GitHub Actions doesn't have access to your local ` ~/.ssh/config ` file
46+ - All scripts use the full hostname ` profullstack.com ` instead of any aliases
47+ - If you need to use a different hostname, update it in:
48+ - ` .github/workflows/deploy.yml `
49+ - ` bin/deploy.sh `
50+ - ` bin/check-deployment.sh `
51+ - ` bin/manual-deploy.sh `
3452
35534 . ** Verify GitHub Actions is enabled** :
3654 - Go to your repository on GitHub
@@ -60,6 +78,87 @@ If the deployment fails, check the following:
6078 - Ensure the deploy script has execute permissions
6179 - Check if the user has permission to write to the deployment directory
6280
63- 4 . ** Script Issues** :
81+ 4 . ** Environment Variables Issues** :
82+ - Make sure the ` ENV_FILE_CONTENT ` secret is properly set in GitHub Secrets
83+ - Verify that all required environment variables are included in the secret
84+ - Check if the .env file is being created correctly in the workflow logs
85+
86+ 5 . ** Script Issues** :
6487 - Review the deploy.sh script for any errors
65- - Check the GitHub Actions logs for detailed error messages
88+ - Check the GitHub Actions logs for detailed error messages
89+
90+ ## Deployment Troubleshooting Scripts
91+
92+ This repository includes several scripts to help troubleshoot deployment issues:
93+
94+ ### Check Deployment Status
95+
96+ Run the following script to check if GitHub Actions deployment is working correctly:
97+
98+ ``` bash
99+ ./bin/check-deployment.sh
100+ ```
101+
102+ This script will:
103+ - Test SSH connection to the server
104+ - Check if the remote directory exists
105+ - Look for GitHub Actions test files
106+ - Create a new test file to verify write access
107+ - Check local Git configuration
108+
109+ ### Manual Deployment
110+
111+ If GitHub Actions deployment isn't working, you can manually deploy using:
112+
113+ ``` bash
114+ ./bin/manual-deploy.sh
115+ ```
116+
117+ This script will:
118+ - Deploy your code using rsync
119+ - Make scripts executable on the remote host
120+ - Run the test script to verify deployment
121+ - Reload systemd daemon
122+ - Optionally install/restart the service
123+
124+ ### Test Script
125+
126+ The test script creates a timestamped file on the server to verify deployment:
127+
128+ ``` bash
129+ ./bin/test-github-actions.sh
130+ ```
131+
132+ This is automatically run by both GitHub Actions and the manual deployment script.
133+
134+ ### Check GitHub Actions Status
135+
136+ To check the status of your GitHub Actions workflows:
137+
138+ ``` bash
139+ ./bin/check-github-actions.sh
140+ ```
141+
142+ This script will:
143+ - Determine your GitHub repository from git remote
144+ - Check workflow status using GitHub CLI (if installed)
145+ - Fall back to using curl with a GITHUB_TOKEN
146+ - Show recent workflow runs and their status
147+
148+ This is particularly useful for diagnosing issues with GitHub Actions not running or failing.
149+
150+ ### Test File for Triggering Workflows
151+
152+ The repository includes a test file that can be modified to trigger a workflow run:
153+
154+ ```
155+ github-actions-test.txt
156+ ```
157+
158+ To trigger a new workflow run:
159+ 1 . Edit the file
160+ 2 . Increment the "Deployment test" number
161+ 3 . Commit and push to master/main
162+ 4 . Check the Actions tab on GitHub to see if the workflow runs
163+
164+ This provides a simple way to test if GitHub Actions is properly configured without making significant code changes.
0 commit comments