Merge pull request #6 from solarspace-dev/share-code #52
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 DigitalOcean | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [main] | |
| jobs: | |
| deploy: | |
| name: SSH Deploy to DO Droplet | |
| runs-on: ubuntu-latest | |
| environment: Production | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Set up SSH | |
| uses: webfactory/[email protected] | |
| with: | |
| ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
| - name: Copy files to droplet via rsync | |
| run: | | |
| rsync -avz --delete -e "ssh -o StrictHostKeyChecking=no -T" ./ ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }}:~/app | |
| - name: SSH into droplet and deploy | |
| run: | | |
| ssh -o StrictHostKeyChecking=no ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }} << 'EOF' | |
| cd ~/app | |
| export DOMAIN_NAME=${{ vars.DOMAIN_NAME }} | |
| export EMAIL_ADDRESS=${{ vars.EMAIL_ADDRESS }} | |
| export GH_CLIENT_ID=${{ secrets.GH_CLIENT_ID }} | |
| export GH_CLIENT_SECRET=${{ secrets.GH_CLIENT_SECRET }} | |
| export SESSION_SECRET=${{ secrets.SESSION_SECRET }} | |
| docker compose down | |
| docker compose up --build -d | |
| EOF |