Created
August 7, 2024 16:19
-
-
Save rodgtr1/a2827e83d9c6e0354caad232c15a21ac to your computer and use it in GitHub Desktop.
Use GitHub actions to set up automated deployment of WordPress site via SSH on any hosting provider
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: Hostinger SSH Deployment | |
on: | |
push: | |
branches: [main] | |
workflow_call: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: main | |
- uses: "shivammathur/setup-php@v2" | |
with: | |
php-version: "8.2" | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "16.x" | |
- name: Install npm dependencies | |
run: npm install | |
- name: Run build task | |
run: npm run production | |
- name: Deploy to Server | |
uses: easingthemes/ssh-deploy@main | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} | |
REMOTE_HOST: ${{ secrets.REMOTE_HOST }} | |
REMOTE_PORT: ${{ secrets.REMOTE_PORT }} | |
REMOTE_USER: ${{ secrets.REMOTE_USER }} | |
ARGS: "-rltgoDzvO" | |
EXCLUDE: "/.git/, /.github/, /.hygen/, /node_modules/" | |
TARGET: public_html/wp-content/themes/tailpress-master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment