File size: 2,576 Bytes
f19244a
3d71aa9
 
0cea0f3
 
f19244a
3d71aa9
9117f82
 
 
3d71aa9
0cea0f3
3d71aa9
 
f19244a
3d71aa9
f19244a
 
3d71aa9
 
 
 
f19244a
3d71aa9
 
 
 
f19244a
3d71aa9
16f0a57
 
 
 
 
0cea0f3
f19244a
 
3d71aa9
f19244a
 
 
 
 
 
 
0cea0f3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0908296
 
0cea0f3
 
 
 
 
 
 
 
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
77
78
79
80
81
82
83
84
85
name: Update Job Database
on:
  schedule:
    - cron: "0 0 * * *" # Daily at midnight (main.py)
    - cron: "0 0 * * 0" # Weekly on Sunday at midnight (training_pipeline.ipynb)
  workflow_dispatch: # Allows manual triggering

permissions:
  contents: write

jobs:
  daily-update:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v3
        with:
          token: ${{ secrets.GITHUB_TOKEN }}

      - name: Set up Python
        uses: actions/setup-python@v4
        with:
          python-version: "3.10"

      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install -r requirements.txt

      - name: Set timezone
        uses: szenius/[email protected]
        with:
          timezoneLinux: "Europe/Stockholm"

      - name: Run daily update script
        env:
          PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
        run: python main.py

      - name: Commit and push if timestamp changed
        run: |
          git config --local user.email "github-actions[bot]@users.noreply.github.com"
          git config --local user.name "github-actions[bot]"
          git add timestamp2.txt
          git diff --quiet && git diff --staged --quiet || (git commit -m "Update timestamp" && git push)

  weekly-training:
    runs-on: ubuntu-latest
    if: github.event.schedule == '0 0 * * 0' # Only run on weekly schedule
    steps:
      - name: Checkout repository
        uses: actions/checkout@v3
        with:
          token: ${{ secrets.GITHUB_TOKEN }}

      - name: Set up Python
        uses: actions/setup-python@v4
        with:
          python-version: "3.10"

      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install -r requirements.txt
          pip install nbconvert jupyter

      - name: Run training pipeline
        env:
          HOPSWORKS_API_KEY: ${{ secrets.HOPSWORKS_API_KEY }}
        run: |
          jupyter nbconvert --to python training_pipeline.ipynb
          python training_pipeline.py

      - name: Run bootstrap script
        env:
          PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
        run: python bootstrap.py

      - name: Commit and push changes
        run: |
          git config --local user.email "github-actions[bot]@users.noreply.github.com"
          git config --local user.name "github-actions[bot]"
          git add .
          git diff --quiet && git diff --staged --quiet || (git commit -m "Weekly training update" && git push)