CI/CD Deploy Digital Ocean #1
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: CI/CD Pipeline | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: 18 | |
| - name: Setup Bun | |
| run: curl -fsSL https://bun.sh/install | bash | |
| - name: Install dependencies | |
| run: bun install | |
| - name: Build project | |
| run: bun run build | |
| - name: Deploy to DigitalOcean Droplet | |
| uses: appleboy/[email protected] | |
| with: | |
| host: ${{ secrets.DO_HOST }} | |
| username: ${{ secrets.DO_USER }} | |
| key: ${{ secrets.DO_SSH_KEY }} | |
| port: 22 | |
| script: | | |
| cd /path/to/your/app | |
| git pull origin main | |
| bun install | |
| bun run build | |
| # Restart your app - example using pm2 | |
| pm2 restart all |