Removed incorrect filename #40
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: Deploy on Production Update | |
on: | |
push: | |
branches: | |
- prod | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
environment: | |
name: production | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Configure SSH | |
run: | | |
mkdir -p ~/.ssh/ | |
echo "$PROD_SSH_KEY" > ~/.ssh/hubgpt_prod.key | |
chmod 600 ~/.ssh/hubgpt_prod.key | |
cat >>~/.ssh/config <<END | |
Host prod | |
HostName $PROD_EC2_HOST_IP | |
User $PROD_EC2_USER | |
IdentityFile ~/.ssh/hubgpt_prod.key | |
StrictHostKeyChecking no | |
END | |
env: | |
PROD_EC2_USER: ${{ secrets.PROD_EC2_USER }} | |
PROD_SSH_KEY: ${{ secrets.PROD_SSH_KEY }} | |
PROD_EC2_HOST_IP: ${{ secrets.PROD_EC2_HOST_IP }} | |
- name: Deploy to Production | |
run: | | |
ssh prod << 'EOF' | |
cd danswer | |
make re-deploy | |
echo "Deployment complete" | |
echo "Last commit merged in:" | |
git --no-pager log -1 | |
EOF | |
- name: Wait before pinging | |
run: sleep 60 | |
- name: Ping the website | |
run: | | |
response=$(curl -o /dev/null -s -w "%{http_code}\n" https://hubgpt.idinsight.io) | |
if [ "$response" -eq 307 ]; then | |
echo "Site is up and returned HTTP status 307" | |
else | |
echo "Site might be down or is not returning expected codes. Code returned: $response" | |
exit 1 | |
fi |