-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (74 loc) · 2.07 KB
/
workflow.yml
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: Workflow
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
name: Test
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip ci')"
strategy:
matrix:
python-version: [3.8]
steps:
- uses: actions/checkout@v2
- name: Set Up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
python -m pip install poetry
poetry install
# - name: Test With pytest
# run: |
# poetry run pytest -v -s
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Docker Build
uses: docker/build-push-action@v1.1.0
with:
push: false
tags: latest
deploy:
name: Deploy
runs-on: ubuntu-latest
needs:
- test
- build
if: "!contains(github.event.head_commit.message, 'skip ci')"
steps:
- name: Update Remote Server
uses: appleboy/ssh-action@v0.1.2
with:
host: andrewbot.init.tools
username: github
password: ${{ secrets.MULTIBOX_GITHUB_PASSWD }}
port: 22
script: |
eval `ssh-agent -s`
ssh-add ~/.ssh/github
cd /opt/dockers/JJBDiscordBot
git fetch
if git diff --quiet main origin/main; then
echo "No Changes Required"
else
rm .env
git pull
touch .env
echo DISCORD_TOKEN=${{ secrets.BOT_TOKEN }} >> .env
echo DISCORD_GUILD="Just Jenny and Brad" >> .env
echo client_id=${{ secrets.TWITCH_CLIENT_ID }} >> .env
echo client_secret=${{ secrets.TWITCH_CLIENT_SECRET }} >> .env
echo twitch_userID=${{ secrets.TWITCH_USERID }} >> .env
echo grant_type=${{ secrets.TWITCH_GRANT_TYPE }} >> .env
docker-compose build --no-cache && docker-compose up -d
fi