Skip to content

Commit

Permalink
Created github workflow for pull and push request
Browse files Browse the repository at this point in the history
  • Loading branch information
PreetinderSinghBadesha committed Jun 14, 2024
1 parent 85062cf commit ab5d4f7
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
27 changes: 27 additions & 0 deletions github/workflows/check-pull-requests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Check Pull Requests

on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
lint-and-test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'

- name: Install dependencies
run: npm install

- name: Run Linter
run: npm run lint

- name: Run Tests
run: npm test
27 changes: 27 additions & 0 deletions github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Deploy to Server

on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up SSH
uses: webfactory/ssh-agent@v0.5.3
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

- name: Pull latest commit on server
env:
SERVER_USER: ${{ secrets.SERVER_USER }}
SERVER_HOST: ${{ secrets.SERVER_HOST }}
SERVER_PATH: ${{ secrets.SERVER_PATH }}
run: |
ssh $SERVER_USER@$SERVER_HOST 'cd $SERVER_PATH && git pull origin main && npm install && npm run build'

0 comments on commit ab5d4f7

Please sign in to comment.