-
Notifications
You must be signed in to change notification settings - Fork 0
37 lines (34 loc) · 1.36 KB
/
deploy-action.yml
File metadata and controls
37 lines (34 loc) · 1.36 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
name: Deploy alerting
run-name: ${{ github.actor }} is testing out GitHub Actions 🚀
on:
push:
branches:
- main
- develop
jobs:
test:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: pip install -r requirements.txt
- name: Show Pytest Version
run: pytest --version
- name: Run tests
run: pytest src/tests
deploy:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v3
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
- run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan ${{ secrets.USER }} >> ~/.ssh/known_hosts
ssh -i ~/.ssh/id_rsa ${{ secrets.USER }}@${{ secrets.HOST }} "cd /home/debian/sentimental_analyses && git pull origin main && docker compose up -d"