Skip to content

refactor(helper): update domain helper functions names to be more des… #23

refactor(helper): update domain helper functions names to be more des…

refactor(helper): update domain helper functions names to be more des… #23

# This workflow will do a clean installation of node dependencies, build the app dist, transfer the dist files to the remote server and clear the cache on the server
name: Production deploy CI
on:
push:
branches: ['main']
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js 22.x
uses: actions/setup-node@v4
with:
node-version: '22.x'
cache: 'npm'
# Node dependencies clean install
- name: Node dependencies clean install
run: npm ci
# Build app dist
- name: Build app dist
run: npm run build --if-present
# Add SSH Key
- name: Add SSH key
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
run: |
mkdir -p ~/.ssh
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
# Deploy dist files to hosting
- name: Deploy to remove server
run: scp -r -P ${{ secrets.SSH_PORT }} -o strictHostKeyChecking=no ./dist/* ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:www/${{ vars.DOMAIN }}/public_html
# Clear cache on the server
- name: Clear cache on the server
run: ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} -p ${{ secrets.SSH_PORT }} "site-tools-client domain update id=5 flush_cache=1"
# Show link
- name: Show link
run: echo "Deployed! https://${{ vars.DOMAIN }}"