-
Notifications
You must be signed in to change notification settings - Fork 2
68 lines (55 loc) · 1.84 KB
/
main.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
name: Run Scraper Monthly
on:
schedule:
- cron: "59 2 2 * *"
jobs:
run-scraper:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
working-directory: ./backend
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Calcula o mês anterior e respectivo ano
id: calc-date
run: |
LAST_MONTH=$(date --date="$(date +%Y-%m-15) -1 month" +%m)
LAST_YEAR=$(date --date="$(date +%Y-%m-15) -1 month" +%Y)
echo "LAST_MONTH=$LAST_MONTH" >> $GITHUB_ENV
echo "LAST_YEAR=$LAST_YEAR" >> $GITHUB_ENV
- name: Executa o raspador
working-directory: ./backend/raspadores/Selenium_transparencia
run: |
python3 portal_transparência_busca_específica.py --ano ${{ env.LAST_YEAR }} --mes ${{ env.LAST_MONTH }}
- name: Cria arquivo .env
working-directory: ./backend
run: |
echo SUPABASE_URL=${{ secrets.SUPABASE_URL }} >> .env
echo SUPABASE_KEY=${{ secrets.SUPABASE_KEY }} >> .env
- name: Instalando Node.js
uses: actions/setup-node@v3
with:
node-version: '20.12.2'
- name: Instalando Node.js dependencias
working-directory: ./backend/
run: |
npm install
- name: Executa insertTendersMonth.js
working-directory: ./backend/src/scripts
run: |
node insertTendersMonth.js
- name: Executa insertTendersYear.js
working-directory: ./backend/src/scripts
run: |
node insertTendersYear.js
- name: Deleta json gerado pelo raspador
working-directory: ./backend/raspadores/Selenium_transparencia
run: |
rm selenium_portal_transparencia_.json