-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpush.bat
More file actions
56 lines (48 loc) · 1.3 KB
/
Copy pathpush.bat
File metadata and controls
56 lines (48 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
@echo off
chcp 65001 >nul
cd /d "%~dp0"
echo ========================================
echo PC Monitor - 自动提交并推送
echo ========================================
echo.
:: 检查git配置
git config user.name >nul 2>&1
if %errorlevel% neq 0 (
echo [错误] 请先配置git用户信息:
echo git config --global user.name "你的名字"
echo git config --global user.email "你的邮箱"
pause
exit /b 1
)
:: 显示当前状态
echo [1/4] 检查修改文件...
git status -s
echo.
:: 暂存所有修改
echo [2/4] 暂存修改...
git add -A
:: 获取修改时间作为提交信息
for /f "tokens=1-3 delims=/ " %%a in ('date /t') do set mydate=%%a-%%b-%%c
for /f "tokens=1-2 delims=: " %%a in ('time /t') do set mytime=%%a:%%b
set commit_msg=Update: %mydate% %mytime%
:: 提交
echo [3/4] 提交: %commit_msg%
git commit -m "%commit_msg%"
if %errorlevel% neq 0 (
echo [提示] 没有需要提交的修改
pause
exit /b 0
)
:: 推送
echo [4/4] 推送到GitHub...
git push origin main 2>&1
if %errorlevel% neq 0 (
git push origin master 2>&1
)
echo.
echo ========================================
echo 完成! GitHub Actions将自动打包exe
echo 查看: https://github.com/Aixgeekx/WindowsWeb-Super-Console/actions
echo ========================================
echo.
pause