Skip to content
This repository has been archived by the owner on Jan 1, 2025. It is now read-only.

Commit

Permalink
ci: verbose logging
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsSim committed Jan 25, 2024
1 parent 7c5f24a commit 57a4b6b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
18 changes: 15 additions & 3 deletions other/fsolauncher-remeshes/build.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
const fs = require( 'fs' );
const archiver = require( 'archiver' );
const path = require( 'path' );
const { execSync } = require('child_process');
const { execSync } = require( 'child_process' );

console.log( "Starting build script..." );

// Read package.json
console.log( "Reading package.json..." );
const packageJson = require( './package.json' );
const version = packageJson.version;
console.log( `Version: ${version}` );

// Execute the timestamp.sh script and parse its output
console.log( "Executing timestamp.sh script..." );
const timestampOutput = execSync( 'bash timestamp.sh' ).toString().trim();
console.log( `timestamp.sh output: ${timestampOutput}` );
const timestamp = timestampOutput.split(' ')[0]; // Timestamp is the first part of the output
console.log( `Extracted timestamp: ${timestamp}` );

// Output file
const outputFilename = `remeshes-${version}-${timestamp}.zip`;
console.log( `Output filename: ${outputFilename}` );
const output = fs.createWriteStream( path.join( __dirname, `../../release/${outputFilename}` ) );
const archive = archiver( 'zip', {
zlib: { level: 9 } // Compression level
Expand All @@ -25,13 +33,17 @@ output.on( 'close', function () {
} );

// Catch errors
archive.on( 'error', function ( err ) {
archive.on( 'error', function ( err ) {
console.error( "Archive error:", err );
throw err;
} );

// Zip the directory
console.log( "Zipping the directory..." );
archive.directory( 'remeshes/', false );

// Finalize the archive
console.log( "Finalizing the archive..." );
archive.pipe( output );
archive.finalize();
archive.finalize();
console.log( "Build script completed." );
18 changes: 14 additions & 4 deletions other/fsolauncher-remeshes/timestamp.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
#!/bin/bash

# Get the latest timestamp from the remesh files
# Redirect debug output to stderr
echo "Starting timestamp.sh script..." >&2

echo "Running git log to get timestamps..." >&2
git log --format="%at %H" --name-only --reverse -- remeshes | awk '
/^[0-9]+/ { timestamp=$1; next }
{ files[$0]=timestamp }
/^[0-9]+/ {
timestamp=$1;
next
}
{
files[$0]=timestamp
}
END {
for (file in files) {
print files[file] " " file
}
}' | sort -rn | head -n 1
}' | sort -rn | head -n 1

echo "timestamp.sh script finished." >&2

0 comments on commit 57a4b6b

Please sign in to comment.