Run Certbot and restart Nginx #8
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: Run Certbot and restart Nginx | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| deploy: | |
| name: Run Certbot to obtain SSL certificate | |
| runs-on: ubuntu-latest | |
| environment: Production | |
| steps: | |
| - name: Set up SSH | |
| uses: webfactory/[email protected] | |
| with: | |
| ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
| - name: SSH into droplet and run certbot | |
| run: | | |
| ssh -o StrictHostKeyChecking=no ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }} << 'EOF' | |
| set -e | |
| cd ~/app | |
| export DOMAIN_NAME=${{ vars.DOMAIN_NAME }} | |
| export EMAIL_ADDRESS=${{ vars.EMAIL_ADDRESS }} | |
| docker compose --profile manual run certbot || true | |
| docker exec nginx nginx -s reload | |
| EOF |