2023-10-30 15:56:29 +08:00
|
|
|
name: Build and Run
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build-and-run:
|
|
|
|
runs-on: ubuntu-latest
|
2023-12-04 15:54:01 +08:00
|
|
|
# 不给权限会报错
|
|
|
|
permissions:
|
|
|
|
contents: write
|
2023-10-30 15:56:29 +08:00
|
|
|
steps:
|
|
|
|
- name: 1. Checkout repository
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
|
|
|
- name: 2. Set up Python
|
|
|
|
uses: actions/setup-python@v4
|
|
|
|
with:
|
|
|
|
python-version: '3.11'
|
|
|
|
|
|
|
|
- name: 3. Install
|
|
|
|
run: |
|
|
|
|
pip install --upgrade pip
|
|
|
|
pip install -r requirements.txt
|
|
|
|
|
|
|
|
- name: 4. Run
|
|
|
|
run: |
|
|
|
|
python ./main.py &
|
|
|
|
sleep 7
|
|
|
|
|
|
|
|
- name: 5. Build
|
|
|
|
run: |
|
|
|
|
wget http://localhost:7777
|
|
|
|
|
|
|
|
- name: 6. Log
|
|
|
|
run: |
|
|
|
|
cat endofyear.log
|
|
|
|
|
|
|
|
- name: 7. Push static HTML
|
|
|
|
uses: peaceiris/actions-gh-pages@v3
|
|
|
|
with:
|
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
publish_dir: ./static
|
2023-12-04 15:54:01 +08:00
|
|
|
publish_branch: html
|