-
Notifications
You must be signed in to change notification settings - Fork 8
48 lines (39 loc) · 1.09 KB
/
test_and_depoly.yml
File metadata and controls
48 lines (39 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: Test and Deploy
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up PHP and PHPUnit
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
tools: composer:v2 phpunit
- name: Install Dependencies
run: composer install
- name: Run PHPUnit
run: ./vendor/bin/phpunit tests
deploy:
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'aston-cs2tp-evotech/evotech'
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Deploy to Server
run: |
mkdir -p ~/.ssh
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh -o StrictHostKeyChecking=no u-220098548@cs2410-web01pvm.aston.ac.uk 'cd ~/public_html && git pull origin main'
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}