Added outputs.

This commit is contained in:
2025-07-10 13:57:01 -07:00
parent 8e73fa5eab
commit b0980a13ab
2 changed files with 29 additions and 4 deletions

View File

@@ -49,14 +49,18 @@ inputs:
description: "List of additional NuGet passwords to use." description: "List of additional NuGet passwords to use."
required: false required: false
default: "${{ github.token }}" default: "${{ github.token }}"
# outputs: outputs:
# query: downloadedArtifacts:
# description: "The query result." description: "The downloaded artifacts."
# value: ${{ steps.query.outputs.console }} value: ${{ steps.download.outputs.downloadedArtifacts }}
downloadedArtifactDirs:
description: "The extracted downloaded artifact directories."
value: ${{ steps.download.outputs.downloadedArtifactDirs }}
runs: runs:
using: "composite" using: "composite"
steps: steps:
- name: "Download artifacts." - name: "Download artifacts."
id: download
uses: act/common/dotnet/dotnet-10@master uses: act/common/dotnet/dotnet-10@master
env: env:
INPUTS: ${{ toJSON(inputs) }} INPUTS: ${{ toJSON(inputs) }}

View File

@@ -121,6 +121,11 @@ if (artifactsToDownload.Length is 0)
return 1; return 1;
} }
StringBuilder artifactsBuilder = new();
artifactsBuilder.AppendLine("downloadedArtifacts<<EOF");
StringBuilder artifactsDirsBuilder = new();
artifactsDirsBuilder.AppendLine("downloadedArtifactDirs<<EOF");
Console.WriteLine("Downloading artifacts:"); Console.WriteLine("Downloading artifacts:");
foreach (ActionArtifact artifact in artifactsToDownload) foreach (ActionArtifact artifact in artifactsToDownload)
@@ -145,6 +150,7 @@ foreach (ActionArtifact artifact in artifactsToDownload)
fs.Close(); fs.Close();
Console.WriteLine($"Downloaded: {fileName}"); Console.WriteLine($"Downloaded: {fileName}");
artifactsBuilder.AppendLine(fileName);
if (string.IsNullOrEmpty(unzipDir)) continue; if (string.IsNullOrEmpty(unzipDir)) continue;
string fullUnzipDir = Path.Combine(unzipDir, artifact.Name); string fullUnzipDir = Path.Combine(unzipDir, artifact.Name);
@@ -152,10 +158,25 @@ foreach (ActionArtifact artifact in artifactsToDownload)
Console.WriteLine($"Unzipping: {fileName} to {fullUnzipDir}"); Console.WriteLine($"Unzipping: {fileName} to {fullUnzipDir}");
System.IO.Compression.ZipFile.ExtractToDirectory(fileName, fullUnzipDir, true); System.IO.Compression.ZipFile.ExtractToDirectory(fileName, fullUnzipDir, true);
artifactsDirsBuilder.AppendLine(fullUnzipDir);
if (deleteAfterUnzip) if (deleteAfterUnzip)
{ {
File.Delete(fileName); File.Delete(fileName);
} }
} }
artifactsBuilder.AppendLine("EOF");
artifactsDirsBuilder.AppendLine("EOF");
string? githubOutput = configuration["GITHUB_OUTPUT"];
if (!string.IsNullOrEmpty(githubOutput))
{
await File.AppendAllTextAsync(githubOutput, artifactsBuilder.ToString());
await File.AppendAllTextAsync(githubOutput, artifactsDirsBuilder.ToString());
}
else
{
Console.WriteLine(artifactsBuilder.ToString());
Console.WriteLine(artifactsDirsBuilder.ToString());
}
return 0; return 0;