Skip to content

Instantly share code, notes, and snippets.

@matezito
Last active March 18, 2022 16:14
Show Gist options
  • Save matezito/f932337f810f6020d8b4280a5b7ac3c3 to your computer and use it in GitHub Desktop.
Save matezito/f932337f810f6020d8b4280a5b7ac3c3 to your computer and use it in GitHub Desktop.
Deploy SSH Github actions
Repo de runner: https://github.com/appleboy/ssh-action
La key que se debe configurar en los secrets del repo es la id_rsa (sin la extensión pub), o la que hayan generado, en mi caso genere una para esto nada mas como dice la documentación del repo runner.
name: PHP Composer
on:
push:
branches: [ dev ]
pull_request:
branches: [ dev ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Validate composer.json and composer.lock
run: composer validate --strict
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: NPM
run: npm install
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: execute remote server actions
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
debug: true
script: |
cd /var/www/html/actions-test
git pull origin dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment