Skip to content

Python application #974

Python application

Python application #974

name: Python application
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
schedule:
- cron: '0 14 * * *'
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# 输出IP
- name: IP
run: sudo curl ifconfig.me
# 设置服务器时区为东八区
- name: Set time zone
run: sudo timedatectl set-timezone 'Asia/Shanghai'
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout
uses: actions/checkout@v2
# 使用python环境
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.x'
# Optional - x64 or x86 architecture, defaults to x64
architecture: 'x64'
# 打印pyton版本
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: install python requirements
run: |
pip3 install -r requirements.txt
# 执行python脚本
- name: get trackers
run: python merge.py
# git 提交文件
- name: Commit files
run: |
git config --local user.email "[email protected]"
git config --local user.name "ModChino"
git add .
git commit -m "`date '+%Y-%m-%d %H:%M:%S'`" #动态提交信息
# 推送到github仓库
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GH_TOKEN }}
branch: ${{ github.ref }}
# 删除以前工作流
- name: Delete workflow runs
uses: GitRML/delete-workflow-runs@main
with:
retain_days: 10