Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/hidrive-next-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,15 @@ jobs:
- name: Add config partials
run: make -f IONOS/Makefile add_config_partials

# IONOS Customization: Inject build number for production traceability
# This is specific to IONOS HiDrive Next and not part of upstream Nextcloud
- name: Inject build number
run: |
echo "${{ github.run_number }}" > .buildnumber
echo "✅ Build number injected: ${{ github.run_number }}"
echo "📄 File created: .buildnumber"
cat .buildnumber

- name: Zip dependencies
run: make -f IONOS/Makefile zip_dependencies TARGET_PACKAGE_NAME=${{ env.TARGET_PACKAGE_NAME }}

Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
/translationfiles
/translationtool.phar

# CI/CD generated files
/.buildnumber

# ignore all apps except core ones
/apps*/*
!/apps/cloud_federation_api
Expand Down
48 changes: 48 additions & 0 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,51 @@

// Vendor of this package
$vendor = 'nextcloud';

// ============================================================================
// CI/CD Build Number Injection (IONOS Nextcloud Workspace)
// ============================================================================
// Injects a 5th element into the $OC_Version array from the .buildnumber file.
// This file is automatically created by the CI/CD pipeline (build-artifact.yml)
// and contains the GitHub workflow run ID for traceability.
//
// NOTE: This is an IONOS-specific customization for Nextcloud Workspace.
// It is not part of upstream Nextcloud and is used for tracking
// IONOS Nextcloud Workspace builds in production environments.
//
// @since 31.0.8
//
// Purpose:
// - Track which specific CI/CD run produced this artifact
// - Enable direct linking to workflow logs and build details
// - Distinguish between different builds of the same version
// - Support debugging by identifying exact build in production
//
// File Format:
// .buildnumber - Single line containing an integer (GitHub run ID)
// Example: 12345678901
//
// Result:
// Without .buildnumber: $OC_Version = [31, 0, 8, 1]
// With .buildnumber: $OC_Version = [31, 0, 8, 1, 12345678901]
//
// Accessed via:
// - ServerVersion::getBuildId() -> 12345678901
// - ServerVersion::getHumanVersion() -> "31.0.8 (12345678901)"
// - ServerVersion::getVersion() -> [31, 0, 8, 1, 12345678901]
//
// Workflow URL Construction:
// https://github.com/{org}/{repo}/actions/runs/{buildId}
//
// ============================================================================
$buildNumberFile = __DIR__ . '/.buildnumber';
if (file_exists($buildNumberFile)) {
$buildNumberContent = @file_get_contents($buildNumberFile);
if ($buildNumberContent !== false) {
$buildId = (int)trim($buildNumberContent);
if ($buildId > 0) {
// Append build ID as 5th element in version array
$OC_Version[] = $buildId;
}
}
}
Loading