Testing hostinger webhook #5
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: PHP CI/CD Pipeline | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.3' | |
tools: composer | |
- name: Validate composer.json and composer.lock | |
run: composer validate | |
- name: Install Dependencies | |
run: composer install --prefer-dist --no-progress --no-suggest | |
- name: Check coding standards (placeholder) | |
run: echo "Run coding standards checks here" | |
# You can integrate tools like PHP_CodeSniffer or PHP-CS-Fixer here | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.3' | |
tools: composer | |
- name: Install Dependencies | |
run: composer install --prefer-dist --no-progress --no-suggest | |
- name: Set up SSH Key and Host | |
run: | | |
mkdir -p ~/.ssh | |
echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
ssh-keyscan -H 45.84.204.10 >> ~/.ssh/known_hosts | |
- name: Deploy to Hostinger | |
run: | | |
rsync -av --delete --exclude='.git*' --exclude='/node_modules' ./ u942333698@45.84.204.10:/home/u942333698/public_html/ | |
env: | |
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }} |