Run DBLP Watch #4919
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run DBLP Watch | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "* 0/12 * * *" #'*/60 * * * *' | |
push: | |
branches: [main] | |
permissions: write-all | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
TZ: "Asia/Shanghai" | |
RUN_ENV: "prod" # within ['prod', 'dev'] | |
steps: | |
# ============================================ | |
# TODO [√] 检查工作分支及 Workflows 运行环境 | |
# ============================================ | |
- name: Checkout | |
uses: actions/checkout@v3 | |
# ============================================ | |
# TODO [√] 创建 Python3.6+ 编译环境 | |
# ============================================ | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: 3.8 | |
# ============================================ | |
# TODO [√] 安装 Project 第三方依赖 | |
# ============================================ | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
# ============================================ | |
# TODO [√] 测试 Scaffold 脚手架指令 | |
# ============================================ | |
- name: Run dblp watcher | |
run: | | |
cd src && python main.py run --env=${{ env.RUN_ENV }} | |
- name: Setup var | |
id: vars | |
run: | | |
content=${{ env.MSG }} | |
content="${content//'%'/'%25'}" | |
content="${content//$'\n'/'%0A'}" | |
content="${content//$'\r'/'%0D'}" | |
echo "::set-output name=content::$content" | |
# ============================================ | |
# TODO [√] 更新仓库数据 | |
# ============================================ | |
- name: Setup GIT user | |
uses: fregante/setup-git-user@v1 | |
- name: Push done work | |
run: | | |
git diff --exit-code || git commit -am "Automated deployment @ $(date '+%Y-%m-%d %H:%M:%S') ${{ env.TZ }}" | |
git push --force origin main | |
- name: Create an issue for new papers | |
if: ${{ env.MSG != '' }} | |
uses: JasonEtco/create-an-issue@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
MSG: ${{ steps.vars.outputs.content }} | |
with: | |
filename: .github/issue-template.md |