Repository navigation
Deploy #91
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 | |
| on: | |
| workflow_dispatch: # Manual triggering | |
| jobs: | |
| deploy: | |
| if: ${{ github.actor == github.repository_owner }} | |
| runs-on: ubuntu-24.04 | |
| environment: Production | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Deploy nginx config | |
| uses: burnett01/rsync-deployments@70ff22f5b4c2bb0e08d0bf20de693389e5552047 #v8 | |
| with: | |
| switches: -avz | |
| path: ./config/ | |
| remote_path: /tmp/nginx-deploy/ | |
| remote_host: ${{ secrets.LIGHTSAIL_IP }} | |
| remote_user: ${{ secrets.LIGHTSAIL_USERNAME }} | |
| remote_key: ${{ secrets.LIGHTSAIL_SSH_KEY }} | |
| - name: Apply nginx config and reload | |
| uses: appleboy/ssh-action@0ff4204d59e8e51228ff73bce53f80d53301dee2 # v1.2.5 | |
| with: | |
| host: ${{ secrets.LIGHTSAIL_IP }} | |
| username: ${{ secrets.LIGHTSAIL_USERNAME }} | |
| key: "${{ secrets.LIGHTSAIL_SSH_KEY }}" | |
| script: | | |
| sudo cp /tmp/nginx-deploy/nginx.conf /etc/nginx/nginx.conf | |
| sudo cp /tmp/nginx-deploy/site.conf /etc/nginx/sites-available/pogotracker.app | |
| sudo cp /tmp/nginx-deploy/security_headers.conf /etc/nginx/snippets/security_headers.conf | |
| sudo nginx -t && sudo systemctl reload nginx | |
| - name: Setup Node.js | |
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
| with: | |
| node-version: "24" | |
| cache: "npm" | |
| cache-dependency-path: app/includes/package-lock.json | |
| - name: Build JS and CSS assets | |
| working-directory: ./app/includes | |
| run: | | |
| npm ci | |
| npm run minJS | |
| npm run minCSS | |
| - name: Update code | |
| uses: burnett01/rsync-deployments@70ff22f5b4c2bb0e08d0bf20de693389e5552047 #v8 | |
| # a - archive preserve permissions, ownership, and symbolic links, v - verbose, z - compress | |
| with: | |
| switches: -avz --rsync-path="sudo rsync" | |
| --exclude='.env' | |
| --exclude='includes/uploads/' | |
| --exclude='includes/.terser.json' | |
| --exclude='includes/eslint.config.js' | |
| --exclude='includes/package-lock.json' | |
| --exclude='includes/package.json' | |
| --exclude='includes/css/' | |
| --exclude='includes/node_modules/' | |
| --exclude='includes/assets/envpokedexoverrides.json' | |
| --include='includes/build/js/modules/***' | |
| --exclude='includes/js/' | |
| --exclude='includes/tests/' | |
| --exclude='includes/.eslintignore' | |
| --exclude='includes/.prettierignore' | |
| --exclude='includes/.prettierrc' | |
| --exclude='includes/playwright.config.js' | |
| --exclude='handlers/dev.cfc' | |
| --exclude='includes/sitemap.xml' | |
| --exclude='coldbox/' | |
| --include='config/modules/***' | |
| --exclude='modules/' | |
| --exclude='tests/' | |
| --exclude='database/seeds/' | |
| --exclude='_testemails/' | |
| --exclude='.cfformat.json' | |
| path: ./app/ | |
| remote_path: /var/www/wwwroot/pogotracker/ | |
| remote_host: ${{ secrets.LIGHTSAIL_IP }} | |
| remote_user: ${{ secrets.LIGHTSAIL_USERNAME }} | |
| remote_key: ${{ secrets.LIGHTSAIL_SSH_KEY }} | |
| - name: Restart, update db, and dependencies | |
| timeout-minutes: 10 | |
| uses: appleboy/ssh-action@0ff4204d59e8e51228ff73bce53f80d53301dee2 # v1.2.5 | |
| with: | |
| host: ${{ secrets.LIGHTSAIL_IP }} | |
| username: ${{ secrets.LIGHTSAIL_USERNAME }} | |
| key: "${{ secrets.LIGHTSAIL_SSH_KEY }}" | |
| script: | | |
| sudo sh -c 'echo "$(date)" > /var/www/wwwroot/pogotracker/version.html' | |
| cd /var/www/wwwroot/pogotracker/ | |
| sudo box recipe scripts/deploy.boxr | |
| timeout: 10m |