-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (46 loc) · 1.36 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
name: main
on:
# run this workflow manually from the Actions tab
workflow_dispatch:
schedule:
- cron: "0 7 * * *"
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 60
# for gcp and git-auto-commit-action
permissions:
contents: write
id-token: write
steps:
- name: Clone repository
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Setup GCP
id: auth
uses: google-github-actions/auth@v2
with:
credentials_json: "${{ secrets.GCP_CREDENTIALS }}"
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
- name: Download sqlite
run: gsutil cp gs://hnhd/hackernews.sqlite ./data
- name: Install dependencies
run: |
pip install beautifulsoup4
pip install sqlalchemy
- name: Run scripts
run: |
python code/crawler.py
python code/crawler.py -o
python code/markdown.py
- name: Upload sqlite
run: gsutil cp ./data/hackernews.sqlite gs://hnhd/hackernews.sqlite
- name: Remove sqlite
run: rm ./data/hackernews.sqlite
- name: Commit if changed
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: updated with the latest headlines