解决job构建失败的问题

This commit is contained in:
Gitea Actions
2025-10-09 17:32:05 +08:00
parent 0c6d0608c5
commit cab5b606a9

View File

@@ -105,22 +105,14 @@ jobs:
exit 1
}
# Read version from updated config.py
$VERSION = ""
# Verify version was updated
if (Test-Path "config.py") {
$configContent = Get-Content "config.py" -Raw
if ($configContent -match 'APP_VERSION\s*=\s*"([\d.]+)"') {
$VERSION = $matches[1]
Write-Host "Extracted version from config.py: $VERSION"
} else {
Write-Host "Failed to extract version from config.py"
Write-Host "Version updated successfully: $VERSION"
}
} else {
Write-Host "config.py not found"
}
# Set version for next steps
echo "VERSION=$VERSION" >> $env:GITHUB_ENV
env:
DB_HOST: 8.155.9.53
DB_NAME: ai_web
@@ -134,7 +126,16 @@ jobs:
shell: powershell
run: |
Write-Host "Committing version changes..."
Write-Host "New version: $env:VERSION"
# Read version from config.py
$VERSION = ""
if (Test-Path "config.py") {
$configContent = Get-Content "config.py" -Raw
if ($configContent -match 'APP_VERSION\s*=\s*"([\d.]+)"') {
$VERSION = $matches[1]
Write-Host "New version: $VERSION"
}
}
git config user.name "Gitea Actions"
git config user.email "actions@gitea.local"
@@ -144,7 +145,7 @@ jobs:
$hasChanges = git diff --staged --quiet
if ($LASTEXITCODE -ne 0) {
git commit -m "[skip ci] Update version to $env:VERSION"
git commit -m "[skip ci] Update version to $VERSION"
git push origin master
Write-Host "Version changes committed and pushed"
} else {
@@ -156,12 +157,21 @@ jobs:
if: always()
shell: powershell
run: |
# Read version from config.py
$VERSION = "Unknown"
if (Test-Path "config.py") {
$configContent = Get-Content "config.py" -Raw
if ($configContent -match 'APP_VERSION\s*=\s*"([\d.]+)"') {
$VERSION = $matches[1]
}
}
Write-Host "=========================================="
Write-Host "GUI Version Release Summary"
Write-Host "=========================================="
Write-Host "Author: ${{ github.actor }}"
Write-Host "Branch: ${{ github.ref_name }}"
Write-Host "Version: $env:VERSION"
Write-Host "Version: $VERSION"
Write-Host "Time: $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')"
Write-Host "Commit: ${{ github.sha }}"
Write-Host "=========================================="