@@ -25,8 +25,8 @@ public class BuildContext : FrostingContext
25
25
public string PulumiPath { get ; }
26
26
public string PulumiStackName { get ; }
27
27
public string ReleaseVersion { get ; }
28
- public string UnzippedArtifactsDir { get ; }
29
28
public string ReleaseArtifactsDownloadDir { get ; }
29
+ public string UnzippedArtifactsDir { get ; }
30
30
31
31
public BuildContext ( ICakeContext context )
32
32
: base ( context )
@@ -35,9 +35,9 @@ public BuildContext(ICakeContext context)
35
35
PulumiStackName = LoadParameter ( context , nameof ( PulumiStackName ) ) ;
36
36
ReleaseVersion = LoadParameter ( context , nameof ( ReleaseVersion ) ) ;
37
37
38
- PulumiPath = WorkspacePath + "/infra/pulumi-infra-deploy" ;
38
+ PulumiPath = LoadParameter ( context , nameof ( PulumiPath ) ) ;
39
+ ReleaseArtifactsDownloadDir = LoadParameter ( context , nameof ( ReleaseArtifactsDownloadDir ) ) ;
39
40
UnzippedArtifactsDir = WorkspacePath + "/unzipped_artifacts" ;
40
- ReleaseArtifactsDownloadDir = WorkspacePath + "/release_artifacts" ;
41
41
}
42
42
43
43
private string LoadParameter ( ICakeContext context , string parameterName )
@@ -46,6 +46,39 @@ private string LoadParameter(ICakeContext context, string parameterName)
46
46
}
47
47
}
48
48
49
+ [ TaskName ( nameof ( UnzipAssetsTask ) ) ]
50
+ public sealed class UnzipAssetsTask : FrostingTask < BuildContext >
51
+ {
52
+ public override void Run ( BuildContext context )
53
+ {
54
+ _ = Directory . CreateDirectory ( context . UnzippedArtifactsDir ) ;
55
+
56
+ ExtractArchive ( "feedback-web-client" , context ) ;
57
+ }
58
+
59
+ private void ExtractArchive ( string zipName , BuildContext context )
60
+ {
61
+ var zipFilePath = $ "{ context . ReleaseArtifactsDownloadDir } /{ zipName } .zip";
62
+ var outputPath = $ "{ context . UnzippedArtifactsDir } /{ zipName } ";
63
+
64
+ context . Log . Information ( $ "Extracting zip '{ zipFilePath } ' to '{ outputPath } '") ;
65
+
66
+ using var fileStream = File . OpenRead ( zipFilePath ) ;
67
+ using var archive = new ZipArchive ( fileStream ) ;
68
+ archive . ExtractToDirectory ( outputPath ) ;
69
+ }
70
+
71
+ private void CopyArchive ( string zipName , BuildContext context )
72
+ {
73
+ var zipFilePath = $ "{ context . ReleaseArtifactsDownloadDir } /{ zipName } .zip";
74
+ var outputPath = $ "{ context . UnzippedArtifactsDir } /{ zipName } .zip";
75
+
76
+ context . Log . Information ( $ "Copying zip '{ zipFilePath } ' to '{ outputPath } '") ;
77
+ File . Copy ( sourceFileName : zipFilePath , destFileName : outputPath ) ;
78
+ }
79
+ }
80
+
81
+ [ IsDependentOn ( typeof ( UnzipAssetsTask ) ) ]
49
82
[ TaskName ( nameof ( UpdatePulumiConfigTask ) ) ]
50
83
public sealed class UpdatePulumiConfigTask : FrostingTask < BuildContext >
51
84
{
@@ -54,8 +87,8 @@ public override void Run(BuildContext context)
54
87
var configFilePath = $ "{ context . PulumiPath } /Pulumi.{ context . PulumiStackName } .yaml";
55
88
var configFileText = File . ReadAllText ( configFilePath ) ;
56
89
57
- configFileText = UpdateConfigValue ( "update-conf-2024:unzipped-artifacts-dir : " , context . UnzippedArtifactsDir , configFileText ) ;
58
- configFileText = UpdateConfigValue ( "update-conf-2024:root-run -path: " , context . WorkspacePath , configFileText ) ;
90
+ configFileText = UpdateConfigValue ( "update-conf-2024:functions-package-path : " , $ " { context . ReleaseArtifactsDownloadDir } /feedback-functions.zip" , configFileText ) ;
91
+ configFileText = UpdateConfigValue ( "update-conf-2024:static-site -path: " , $ " { context . UnzippedArtifactsDir } /feedback-web-client" , configFileText ) ;
59
92
60
93
File . WriteAllText ( configFilePath , configFileText ) ;
61
94
context . Log . Information ( "Pulumi Config: \n " + configFileText ) ;
0 commit comments