-
Notifications
You must be signed in to change notification settings - Fork 29
64 lines (55 loc) · 1.9 KB
/
github-scraper-deploy.yaml
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
name: github scraper deploy
on:
push:
paths:
- .github/workflows/github-scraper-deploy.yaml
- scraper/github/**
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: scraper/github
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install virtualenv
make install-deps
- name: Run unit tests
run: |
make test
- name: Setup env variables
# multistring env variables check this out
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#multiline-strings
#
run: |
echo 'SCP_FILES=scraper/github/build.tar' >> $GITHUB_ENV
echo 'ARCHIVE=build.tar' >> $GITHUB_ENV
echo 'SCP_TARGET<<EOF' >> $GITHUB_ENV
cat ./deploy/target.txt >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
tar -cvf build.tar $(find ./* -maxdepth 0 | grep -vf ./deploy/excluded_files.txt)
- name: Copy file via scp
uses: appleboy/scp-action@master
with:
host: ${{ secrets.DROPLET_HOST }}
username: ${{ secrets.DROPLET_DEPLOY_USERNAME }}
key: ${{ secrets.DROPLET_DEPLOY_SSHKEY }}
source: ${{ env.SCP_FILES }}
target: ${{ env.SCP_TARGET }}
overwrite: true
- name: Executing remote command
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.DROPLET_HOST }}
username: ${{ secrets.DROPLET_DEPLOY_USERNAME }}
key: ${{ secrets.DROPLET_DEPLOY_SSHKEY }}
script: cd ${{ env.SCP_TARGET }}/scraper/github && tar -xvf ${{ env.ARCHIVE }} && rm -rf ${{ env.ARCHIVE }}