Skip to content

Commit

Permalink
Add step tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
andreiborza committed Jan 8, 2025
1 parent 7a50d4d commit 2839b6b
Showing 1 changed file with 35 additions and 27 deletions.
62 changes: 35 additions & 27 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as core from '@actions/core';
import {getCLI} from './cli';
import * as options from './options';
import * as process from 'process';
import {isTelemetryEnabled, withTelemetry} from './telemetry';
import {isTelemetryEnabled, traceStep, withTelemetry} from './telemetry';

withTelemetry(
{
Expand Down Expand Up @@ -41,43 +41,51 @@ withTelemetry(
}

if (setCommitsOption !== 'skip') {
core.debug(`Setting commits with option '${setCommitsOption}'`);
await cli.setCommits(version, {
auto: true,
ignoreMissing,
ignoreEmpty,
await traceStep('set-commits', async () => {
core.debug(`Setting commits with option '${setCommitsOption}'`);
await cli.setCommits(version, {
auto: true,
ignoreMissing,
ignoreEmpty,
});
});
}

if (sourcemaps.length) {
core.debug(`Adding sourcemaps`);
await Promise.all(
projects.map(async project => {
// upload source maps can only do one project at a time
const localProjects: [string] = [project];
const sourceMapOptions = {
include: sourcemaps,
projects: localProjects,
dist,
urlPrefix,
stripCommonPrefix,
};
return cli.uploadSourceMaps(version, sourceMapOptions);
})
);
await traceStep('upload-sourcemaps', async () => {
core.debug(`Adding sourcemaps`);
await Promise.all(
projects.map(async project => {
// upload source maps can only do one project at a time
const localProjects: [string] = [project];
const sourceMapOptions = {
include: sourcemaps,
projects: localProjects,
dist,
urlPrefix,
stripCommonPrefix,
};
return cli.uploadSourceMaps(version, sourceMapOptions);
})
);
});
}

if (environment) {
core.debug(`Adding deploy to release`);
await cli.newDeploy(version, {
env: environment,
...(deployStartedAtOption && {started: deployStartedAtOption}),
await traceStep('add-environment', async () => {
core.debug(`Adding deploy to release`);
await cli.newDeploy(version, {
env: environment,
...(deployStartedAtOption && {started: deployStartedAtOption}),
});
});
}

core.debug(`Finalizing the release`);
if (shouldFinalize) {
await cli.finalize(version);
await traceStep('finalizing-release', async () => {
core.debug(`Finalizing the release`);
await cli.finalize(version);
});
}

if (workingDirectory !== null && workingDirectory.length > 0) {
Expand Down

0 comments on commit 2839b6b

Please # to comment.