del-post. 2024-11-28 #628
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: Markdown-To-Z-Blog | |
on: | |
push: | |
branches: | |
- main | |
# - test-* | |
paths: | |
- '_posts/**' | |
jobs: | |
def: | |
runs-on: ubuntu-20.04 | |
env: | |
TZ: Asia/Shanghai | |
steps: | |
# Checkout | |
- name: Checkout | |
uses: actions/checkout@v3 | |
# Setup Python | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
cache: 'pipenv' | |
# Install pipenv and dependencies | |
- name: Install pipenv and dependencies | |
run: | | |
pip3 install --user pipenv | |
pipenv --python python3 && pipenv install | |
# Get Post Changes | |
- name: Get changed files | |
id: changed-files | |
uses: tj-actions/changed-files@v37 | |
# List all changed files | |
- name: List all changed files | |
run: | | |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do | |
echo "$file was changed" | |
done | |
# Post To Z-BlogPHP | |
- name: Post | |
env: | |
API_USR: ${{ secrets.API_USR }} | |
API_PWD: ${{ secrets.API_PWD }} | |
API_URL: ${{ secrets.API_URL }} | |
IMG_HOST: ${{ secrets.IMG_HOST }} | |
GIT_REPO: ${{ github.repository }} | |
GIT_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | |
run: | | |
pipenv run post | |
# Commit Changes To Git | |
- name: Commit files | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git status | |
git diff-index --quiet HEAD || (git commit -m "Auto Commit" -a --no-verify) | |
# Push Changes To Git | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} |