Files
my-lotto/.github/workflows/lotto-buy.yml

93 lines
2.5 KiB
YAML

name: 로또 자동 구매
on:
schedule:
- cron: "0 0 * * 5" # 매주 금요일 00:00 UTC = 09:00 KST
workflow_dispatch: # 수동 실행 버튼
jobs:
buy:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: 체크아웃
uses: actions/checkout@v4
- name: venv 캐시
id: cache-venv
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('lotto-runner/requirements.txt') }}
restore-keys: |
venv-${{ runner.os }}-
- name: Python 및 시스템 의존성 설치
if: steps.cache-venv.outputs.cache-hit != 'true'
run: |
apt-get update
apt-get install -y \
python3 \
python3-pip \
python3-venv \
build-essential \
curl \
unzip \
fonts-liberation \
libasound2 \
libatk-bridge2.0-0 \
libatk1.0-0 \
libc6 \
libcairo2 \
libcups2 \
libdbus-1-3 \
libexpat1 \
libfontconfig1 \
libgbm1 \
libgcc1 \
libglib2.0-0 \
libgtk-3-0 \
libnspr4 \
libnss3 \
libpango-1.0-0 \
libpangocairo-1.0-0 \
libstdc++6 \
libx11-6 \
libx11-xcb1 \
libxcb1 \
libxcomposite1 \
libxcursor1 \
libxdamage1 \
libxext6 \
libxfixes3 \
libxi6 \
libxrandr2 \
libxrender1 \
libxss1 \
libxtst6 \
xdg-utils
python3 --version
python3 -m venv .venv
.venv/bin/python -m pip install --upgrade pip setuptools wheel
.venv/bin/pip install -r lotto-runner/requirements.txt
- name: Chrome 설치
uses: browser-actions/setup-chrome@v1
with:
install-dependencies: true
install-driver: true
- name: Chrome 확인
run: |
chrome --version || google-chrome --version || chromium --version
- name: 로또 구매 실행
env:
LOTTO_USER_ID: ${{ secrets.LOTTO_USER_ID }}
LOTTO_USER_PW: ${{ secrets.LOTTO_USER_PW }}
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
run: .venv/bin/python3 lotto-runner/lotto_auto_buy.py