Github Actions의 설정과 학사일정의 대한 정보 추가 및 인스타 업로드 연동
This commit is contained in:
parent
974d900321
commit
468676c432
5 changed files with 201 additions and 78 deletions
78
.github/workflows/school-event.yml
vendored
Normal file
78
.github/workflows/school-event.yml
vendored
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
name: School Event Manual
|
||||
|
||||
on:
|
||||
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 }}
|
||||
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||
|
||||
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 cookie.json with timestamp check
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: /home/runner/work/today.isangjeong/today.isangjeong/app/temp/auth/cookies.json
|
||||
key: ${{ runner.os }}-cookie-${{ steps.timestamp.outputs.timestamp }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-cookie-
|
||||
|
||||
- name: Set timestamp for cookie.json
|
||||
id: timestamp
|
||||
run: |
|
||||
echo "::set-output name=timestamp::$(date -r /home/runner/work/today.isangjeong/today.isangjeong/app/temp/auth/cookies.json +'%s')"
|
||||
|
||||
- name: Install dependencies (only if requirements.txt changed)
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements.txt || echo "No changes in requirements.txt, skipping installation"
|
||||
|
||||
- name: Set Permissions
|
||||
run: |
|
||||
chmod +x app/run.sh app/gen-config.sh
|
||||
|
||||
- name: Generate Config
|
||||
run: |
|
||||
cd app
|
||||
./gen-config.sh
|
||||
|
||||
- name: Add SSH private key
|
||||
run: |
|
||||
mkdir -p ~/.ssh
|
||||
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_ed25519
|
||||
chmod 600 ~/.ssh/id_ed25519
|
||||
|
||||
- name: Start SOCKS proxy with SSH
|
||||
run: |
|
||||
ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_ed25519 -D 9999 -f -N imnyang@imnya.ng -p5322
|
||||
echo "SOCKS proxy started"
|
||||
|
||||
- name: Run application
|
||||
run: |
|
||||
cd app
|
||||
python3 force-event.py
|
||||
Loading…
Add table
Add a link
Reference in a new issue