Merge branch 'dev' into stg #47
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: Deploy to Production | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup SSH | |
uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
- name: Add known hosts | |
run: | | |
mkdir -p ~/.ssh | |
echo "${{ secrets.KNOWN_HOSTS }}" >> ~/.ssh/known_hosts | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: "20" | |
- name: Install dependencies and build theme | |
working-directory: ./wp-content/themes/chrisbuyshomes | |
run: | | |
npm install | |
npm run build | |
# Install dependencies and build the chris-buys-blocks plugin | |
- name: Install dependencies and build chris-buys-blocks plugin | |
working-directory: ./wp-content/plugins/chris-buys-blocks | |
run: | | |
npm install | |
npm run build | |
# Install dependencies and build the carrot-blocks plugin | |
- name: Install dependencies and build carrot-blocks plugin | |
working-directory: ./wp-content/plugins/carrot-blocks | |
run: | | |
npm install | |
npm run build | |
# Sync themes and plugins to the staging server, excluding node_modules | |
- name: Sync Plugins and Themes to Production | |
run: | | |
rsync -avz --delete \ | |
--exclude 'node_modules' \ | |
./wp-content/themes/ rootadmin@${{ secrets.SERVER_IP }}:/home/rootadmin/public_html/legacy.chrisbuyshomes.com/wp-content/themes | |
rsync -avz --delete \ | |
--exclude 'node_modules' \ | |
./wp-content/plugins/ rootadmin@${{ secrets.SERVER_IP }}:/home/rootadmin/public_html/legacy.chrisbuyshomes.com/wp-content/plugins | |
- name: Run Database Migrations in Production | |
run: | | |
ssh rootadmin@${{ secrets.SERVER_IP }} "wp core update-db --path=/home/rootadmin/public_html/legacy.chrisbuyshomes.com" |