today.isangjeong/.github/workflows/python-app.yml
2025-01-09 22:17:52 +09:00

71 lines
1.6 KiB
YAML

name: Python application
on:
schedule:
- cron: "0 13 * * 0-4"
workflow_dispatch:
jobs:
run:
runs-on: ubuntu-latest
environment: Main
env:
BOT_ROOT: ${{ vars.BOT_ROOT }}
BOT_INSTAGRAM_ID: ${{ secrets.BOT_INSTAGRAM_ID }}
BOT_INSTAGRAM_PASSWD: ${{ secrets.BOT_INSTAGRAM_PASSWD }}
BOT_INSTAGRAM_TOTP: ${{ secrets.BOT_INSTAGRAM_TOTP }}
BOT_KEY: ${{ secrets.BOT_KEY }}
BOT_WEBHOOK_URL: ${{ secrets.BOT_WEBHOOK_URL }}
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v3
with:
python-version: "3.12"
# Cache Python dependencies
- name: Cache Python dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
# Cache cookie.json
- name: Cache app/temp/cookie.json
uses: actions/cache@v3
with:
path: app/temp/cookie.json
key: ${{ runner.os }}-cookie-${{ hashFiles('app/temp/cookie.json') }}
restore-keys: |
${{ runner.os }}-cookie-
- name: Install dependencies
run: |
pwd
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Set Permission
run: |
cd app
chmod +x run.sh
chmod +x gen-config.sh
- name: Generate Config
run: |
cd app
pwd
ls -al
./gen-config.sh
- name: Run
run: |
cd app
pwd
ls -al
./run.sh