mirror of
https://gitlab.com/vyla-entertainment/home.git
synced 2026-11-20 17:15:39 -05:00
publish release directly in build job
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
stages:
|
stages:
|
||||||
- build
|
- build
|
||||||
- release
|
|
||||||
|
|
||||||
build:
|
build:
|
||||||
stage: build
|
stage: build
|
||||||
@@ -94,15 +93,14 @@ build:
|
|||||||
|
|
||||||
if (-not $changed) {
|
if (-not $changed) {
|
||||||
Write-Host "No changes detected. Skipping build."
|
Write-Host "No changes detected. Skipping build."
|
||||||
echo "CHANGED=false" >> build.env
|
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "CHANGED=true" >> build.env
|
|
||||||
|
|
||||||
|
# 2. Build the payload and encrypt credentials
|
||||||
- Write-Host "Starting secure build process..."
|
- Write-Host "Starting secure build process..."
|
||||||
- node build-pipeline.js
|
- node build-pipeline.js
|
||||||
|
|
||||||
|
# 3. Verify Artifacts
|
||||||
- |
|
- |
|
||||||
if (Test-Path "update-payload.zip") {
|
if (Test-Path "update-payload.zip") {
|
||||||
Write-Host "✓ Build artifact verified: update-payload.zip exists"
|
Write-Host "✓ Build artifact verified: update-payload.zip exists"
|
||||||
@@ -128,40 +126,50 @@ build:
|
|||||||
- Write-Host "Packaging Electron application..."
|
- Write-Host "Packaging Electron application..."
|
||||||
- npm run dist
|
- npm run dist
|
||||||
|
|
||||||
- echo "BUILD_VERSION=v$env:CI_PIPELINE_IID" >> build.env
|
- |
|
||||||
|
Write-Host "Publishing Release to GitLab..."
|
||||||
|
$versionTag = "v$env:CI_PIPELINE_IID"
|
||||||
|
|
||||||
|
$releaseBody = @{
|
||||||
|
name = "Vyla Home Release $versionTag"
|
||||||
|
tag_name = "$versionTag"
|
||||||
|
description = "Automated release for build $versionTag"
|
||||||
|
ref = "$env:CI_COMMIT_BRANCH"
|
||||||
|
assets = @{
|
||||||
|
links = @(
|
||||||
|
@{
|
||||||
|
name = "update-payload.zip"
|
||||||
|
url = "$env:CI_PROJECT_URL/-/jobs/artifacts/$env:CI_COMMIT_BRANCH/raw/update-payload.zip?job=build"
|
||||||
|
},
|
||||||
|
@{
|
||||||
|
name = "manifest.json"
|
||||||
|
url = "$env:CI_PROJECT_URL/-/jobs/artifacts/$env:CI_COMMIT_BRANCH/raw/manifest.json?job=build"
|
||||||
|
},
|
||||||
|
@{
|
||||||
|
name = "Download All Build Artifacts (including Windows Installer)"
|
||||||
|
url = "$env:CI_PROJECT_URL/-/jobs/artifacts/$env:CI_COMMIT_BRANCH/download?job=build"
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} | ConvertTo-Json -Depth 5
|
||||||
|
|
||||||
|
$releaseHeaders = @{
|
||||||
|
"PRIVATE-TOKEN" = "$env:GITLAB_TOKEN"
|
||||||
|
"Content-Type" = "application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$createdRelease = Invoke-RestMethod -Uri "https://gitlab.com/api/v4/projects/vyla-entertainment%2Fhome/releases" -Method Post -Headers $releaseHeaders -Body $releaseBody
|
||||||
|
Write-Host "✓ Release successfully published: $($createdRelease.tag_name)"
|
||||||
|
} catch {
|
||||||
|
Write-Warning "Release creation note: $($_.Exception.Message)"
|
||||||
|
}
|
||||||
|
|
||||||
artifacts:
|
artifacts:
|
||||||
reports:
|
|
||||||
dotenv: build.env
|
|
||||||
paths:
|
paths:
|
||||||
- update-payload.zip
|
- update-payload.zip
|
||||||
- manifest.json
|
- manifest.json
|
||||||
- validation-report.json
|
- validation-report.json
|
||||||
- dist/*.exe
|
- dist/*.exe
|
||||||
- dist/*.exe.blockmap
|
- dist/*.exe.blockmap
|
||||||
expire_in: 30 days
|
expire_in: 30 days
|
||||||
|
|
||||||
release:
|
|
||||||
stage: release
|
|
||||||
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
|
||||||
tags:
|
|
||||||
- saas-linux-small-amd64
|
|
||||||
needs:
|
|
||||||
- job: build
|
|
||||||
artifacts: true
|
|
||||||
rules:
|
|
||||||
- if: '$CHANGED == "true" && $CI_COMMIT_BRANCH == "main"'
|
|
||||||
script:
|
|
||||||
- echo "Creating GitLab Release $BUILD_VERSION"
|
|
||||||
release:
|
|
||||||
name: 'Vyla Home Release $BUILD_VERSION'
|
|
||||||
tag_name: '$BUILD_VERSION'
|
|
||||||
description: 'Automated release for build $BUILD_VERSION'
|
|
||||||
assets:
|
|
||||||
links:
|
|
||||||
- name: 'update-payload.zip'
|
|
||||||
url: '$CI_PROJECT_URL/-/jobs/artifacts/$CI_COMMIT_BRANCH/raw/update-payload.zip?job=build'
|
|
||||||
- name: 'manifest.json'
|
|
||||||
url: '$CI_PROJECT_URL/-/jobs/artifacts/$CI_COMMIT_BRANCH/raw/manifest.json?job=build'
|
|
||||||
- name: 'Download All Build Artifacts (including Windows Installer)'
|
|
||||||
url: '$CI_PROJECT_URL/-/jobs/artifacts/$CI_COMMIT_BRANCH/download?job=build'
|
|
||||||
Reference in New Issue
Block a user