82 lines
2.4 KiB
YAML
82 lines
2.4 KiB
YAML
# Simple workflow for deploying static content to GitHub Pages
|
|
name: Update Deploy to Pages
|
|
|
|
on:
|
|
# Runs on pushes targeting the default branch
|
|
push:
|
|
branches: ["main"]
|
|
|
|
# Allows you to run this workflow manually from the Actions tab
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
DEPLOY_REF: ${{ github.event.inputs.deploy_branch || github.ref }}
|
|
# UPLOAD_PATH: "."
|
|
TZ: Asia/Shanghai
|
|
|
|
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
|
permissions:
|
|
contents: write
|
|
actions: write
|
|
pages: write
|
|
id-token: write
|
|
pull-requests: write # 'write' access to pull requests
|
|
|
|
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
|
|
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
|
|
concurrency:
|
|
group: "pages"
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
# Single deploy job since we're just deploying
|
|
deploy:
|
|
environment:
|
|
name: github-pages
|
|
url: ${{ steps.deployment.outputs.page_url }}
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v7
|
|
with:
|
|
repository: cluntop/tvbox
|
|
token: ${{ secrets.GIT_TOKEN }}
|
|
fetch-depth: 1
|
|
lfs: true
|
|
|
|
- name: 🔄 Auto Commit Timestamp
|
|
if: github.event_name == 'schedule'
|
|
run: |
|
|
# cd ${{ env.UPLOAD_PATH }}
|
|
# echo "Last deployment run at: $(date)" > last_run.txt
|
|
git config --global user.name "github-actions[bot]"
|
|
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
# git add last_run.txt
|
|
if ! git diff-index --quiet HEAD; then
|
|
git commit -m "🤖 Auto-update: Scheduled deployment [skip ci]"
|
|
git push
|
|
echo "::notice::✅ 已自动提交更新时间戳"
|
|
else
|
|
echo "::notice::⚠️ 无文件变更,跳过提交"
|
|
fi
|
|
|
|
- name: Setup Pages
|
|
uses: actions/configure-pages@v6
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-pages-artifact@v5
|
|
with:
|
|
# Upload entire repository
|
|
# path: ${{ env.UPLOAD_PATH }}
|
|
retention-days: 1
|
|
|
|
- name: Push changes
|
|
uses: ad-m/github-push-action@master
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
branch: ${{ github.ref }}
|
|
# pull: rebase # pull --rebase before push; also accepts: merge | ff-only | true
|