Refactor eleventy.config.js for clarity and updates #3
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: Build and Deploy to cPanel | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: π Checkout | |
| uses: actions/checkout@v3 | |
| - name: π’ Setup Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '18' | |
| # Remove cache since package-lock.json might not be committed | |
| - name: π¦ Install Dependencies | |
| run: npm install | |
| - name: ποΈ Build Site | |
| run: npm run build | |
| env: | |
| NODE_ENV: production | |
| - name: π Create .htaccess | |
| run: | | |
| cat > ./_site/.htaccess << 'EOF' | |
| RewriteEngine On | |
| RewriteBase /brutalism/ | |
| RewriteCond %{REQUEST_FILENAME} !-d | |
| RewriteCond %{REQUEST_URI} (.+)/$ | |
| RewriteRule ^ %1 [R=301,L] | |
| RewriteCond %{REQUEST_FILENAME} -d | |
| RewriteCond %{REQUEST_URI} !(.*)/$ | |
| RewriteRule ^(.*)$ $1/ [R=301,L] | |
| RewriteCond %{REQUEST_FILENAME} !-f | |
| RewriteCond %{REQUEST_FILENAME} !-d | |
| RewriteRule ^(.*)$ index.html [L] | |
| Options -Indexes | |
| AddDefaultCharset UTF-8 | |
| <IfModule mod_deflate.c> | |
| AddOutputFilterByType DEFLATE text/html text/css text/javascript application/javascript | |
| </IfModule> | |
| EOF | |
| - name: π Deploy to cPanel via FTPS | |
| uses: SamKirkland/FTP-Deploy-Action@v4.3.6 | |
| with: | |
| server: ${{ secrets.FTP_HOST }} | |
| username: ${{ secrets.FTP_USERNAME }} | |
| password: ${{ secrets.FTP_PASSWORD }} | |
| protocol: ftps | |
| port: 21 | |
| local-dir: ./_site/ | |
| server-dir: ./public_html/brutalism/ | |
| dangerous-clean-slate: true | |
| security: loose | |
| exclude: | | |
| **/.git* | |
| **/.git*/** | |
| **/node_modules/** | |
| **/.DS_Store | |
| **/package*.json | |
| - name: β Deployment Complete | |
| run: echo "π Site live at https://rs-db.fyi/brutalism/" |