mirror of
https://gitlab.com/vyla-entertainment/home.git
synced 2026-11-19 16:47:21 -05:00
fix PowerShell compatibility and make git push non-fatal
This commit is contained in:
@@ -51,8 +51,12 @@ build:
|
|||||||
- |
|
- |
|
||||||
$repos = @("frontend", "player", "stream-api", "auth-proxy")
|
$repos = @("frontend", "player", "stream-api", "auth-proxy")
|
||||||
$last = @{}
|
$last = @{}
|
||||||
|
|
||||||
if (Test-Path "last-shas.json") {
|
if (Test-Path "last-shas.json") {
|
||||||
$last = Get-Content last-shas.json | ConvertFrom-Json -AsHashtable
|
$rawJson = Get-Content "last-shas.json" -Raw | ConvertFrom-Json
|
||||||
|
if ($rawJson) {
|
||||||
|
$rawJson.psobject.properties | ForEach-Object { $last[$_.Name] = $_.Value }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$current = @{}
|
$current = @{}
|
||||||
@@ -96,15 +100,19 @@ build:
|
|||||||
echo "CHANGED=true" >> build.env
|
echo "CHANGED=true" >> build.env
|
||||||
|
|
||||||
- |
|
- |
|
||||||
git config user.name "gitlab-ci[bot]"
|
try {
|
||||||
git config user.email "gitlab-ci[bot]@gitlab.com"
|
git config user.name "gitlab-ci[bot]"
|
||||||
git add last-shas.json
|
git config user.email "gitlab-ci[bot]@gitlab.com"
|
||||||
|
git add last-shas.json
|
||||||
|
|
||||||
$gitStatus = git status --porcelain
|
$gitStatus = git status --porcelain
|
||||||
if ($gitStatus) {
|
if ($gitStatus) {
|
||||||
git remote set-url origin "https://oauth2:$env:GITLAB_TOKEN@gitlab.com/$env:CI_PROJECT_PATH.git"
|
git remote set-url origin "https://oauth2:$env:GITLAB_TOKEN@gitlab.com/$env:CI_PROJECT_PATH.git"
|
||||||
git commit -m "chore: update last-known repo SHAs [skip ci]"
|
git commit -m "chore: update last-known repo SHAs [skip ci]"
|
||||||
git push origin "HEAD:$env:CI_COMMIT_BRANCH"
|
git push origin "HEAD:$env:CI_COMMIT_BRANCH"
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
Write-Warning "Could not push last-shas.json back to git repository. Proceeding with build..."
|
||||||
}
|
}
|
||||||
|
|
||||||
- Write-Host "Starting secure build process..."
|
- Write-Host "Starting secure build process..."
|
||||||
|
|||||||
Reference in New Issue
Block a user