修改ci/cd
This commit is contained in:
@@ -77,13 +77,23 @@ jobs:
|
|||||||
|
|
||||||
# Retry mechanism: maximum 3 attempts
|
# Retry mechanism: maximum 3 attempts
|
||||||
$SUCCESS = $false
|
$SUCCESS = $false
|
||||||
|
$VERSION = ""
|
||||||
for ($i = 1; $i -le 3; $i++) {
|
for ($i = 1; $i -le 3; $i++) {
|
||||||
Write-Host "Attempt $i to create version record..."
|
Write-Host "Attempt $i to create version record..."
|
||||||
|
|
||||||
python .gitea/scripts/gui_version_creator.py
|
$output = python .gitea/scripts/gui_version_creator.py | Out-String
|
||||||
if ($LASTEXITCODE -eq 0) {
|
if ($LASTEXITCODE -eq 0) {
|
||||||
Write-Host "Version record created successfully"
|
Write-Host "Version record created successfully"
|
||||||
$SUCCESS = $true
|
$SUCCESS = $true
|
||||||
|
|
||||||
|
# Extract version from JSON output (last line)
|
||||||
|
$jsonLine = ($output -split "`n" | Where-Object { $_ -match '^\{' } | Select-Object -Last 1)
|
||||||
|
if ($jsonLine) {
|
||||||
|
$json = $jsonLine | ConvertFrom-Json
|
||||||
|
$VERSION = $json.version
|
||||||
|
Write-Host "Created version: $VERSION"
|
||||||
|
}
|
||||||
|
|
||||||
break
|
break
|
||||||
} else {
|
} else {
|
||||||
Write-Host "Attempt $i failed"
|
Write-Host "Attempt $i failed"
|
||||||
@@ -100,6 +110,9 @@ jobs:
|
|||||||
Write-Host "Version creation failed"
|
Write-Host "Version creation failed"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Set version for next steps
|
||||||
|
echo "VERSION=$VERSION" >> $env:GITHUB_ENV
|
||||||
env:
|
env:
|
||||||
DB_HOST: 8.155.9.53
|
DB_HOST: 8.155.9.53
|
||||||
DB_NAME: ai_web
|
DB_NAME: ai_web
|
||||||
@@ -107,7 +120,30 @@ jobs:
|
|||||||
DB_PASSWORD: password_ee2iQ3
|
DB_PASSWORD: password_ee2iQ3
|
||||||
DB_PORT: 5400
|
DB_PORT: 5400
|
||||||
|
|
||||||
# Step 5: Display summary
|
# Step 5: Commit changes back to repository
|
||||||
|
- name: Commit version changes
|
||||||
|
if: success()
|
||||||
|
shell: powershell
|
||||||
|
run: |
|
||||||
|
Write-Host "Committing version changes..."
|
||||||
|
Write-Host "New version: $env:VERSION"
|
||||||
|
|
||||||
|
git config user.name "Gitea Actions"
|
||||||
|
git config user.email "actions@gitea.local"
|
||||||
|
|
||||||
|
git add config.py
|
||||||
|
git add version_history.json
|
||||||
|
|
||||||
|
$hasChanges = git diff --staged --quiet
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
git commit -m "[skip ci] Update version to $env:VERSION"
|
||||||
|
git push origin master
|
||||||
|
Write-Host "Version changes committed and pushed"
|
||||||
|
} else {
|
||||||
|
Write-Host "No changes to commit"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Step 6: Display summary
|
||||||
- name: Display summary
|
- name: Display summary
|
||||||
if: always()
|
if: always()
|
||||||
shell: powershell
|
shell: powershell
|
||||||
|
|||||||
Reference in New Issue
Block a user