Workflow file for this run
This file contains 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 dev and prod | |
on: | |
workflow_dispatch: | |
push: | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.2' | |
extensions: curl | |
coverage: none | |
- name: Install Composer dependencies | |
run: | | |
composer update | |
composer install --no-dev --optimize-autoloader | |
- name: Set-up Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Install Node dependencies | |
run: | | |
npm install | |
npx browserslist@latest --update-db | |
- name: Build CSS | |
run: | | |
npx tailwindcss -i assets/style.css -o dist/style.css --minify | |
npx tailwindcss -i assets/editor.css -o dist/editor.css --minify | |
env: | |
NODE_ENV: production | |
- name: Deploy to remote server | |
uses: easingthemes/ssh-deploy@main | |
with: | |
REMOTE_HOST: ${{ secrets.REMOTE_HOST }} | |
REMOTE_USER: ${{ github.ref == 'refs/heads/main' && secrets.REMOTE_USER || secrets.REMOTE_USER_DEV }} | |
REMOTE_PORT: ${{ secrets.REMOTE_PORT }} | |
TARGET: ${{ github.ref == 'refs/heads/main' && secrets.REMOTE_PATH || secrets.REMOTE_PATH_DEV }} | |
SSH_PRIVATE_KEY: ${{ secrets.REMOTE_KEY }} | |
ARGS: '-avz --delete' | |
EXCLUDE: '/node_modules/, /.git/, /.github' | |
- name: Purge cache | |
if: github.ref == 'refs/heads/main' | |
uses: nathanvaughn/actions-cloudflare-purge@master | |
with: | |
cf_zone: ${{ secrets.CLOUDFLARE_ZONE }} | |
cf_auth: ${{ secrets.CLOUDFLARE_AUTH_KEY }} |