@@ -4,9 +4,10 @@ import * as ossDeployment from '@alicloud/ros-cdk-ossdeployment';
44import path from 'node:path' ;
55import JSZip from 'jszip' ;
66import { logger } from './logger' ;
7- import { ActionContext , CdkAssets } from '../types' ;
7+ import { CdkAssets } from '../types' ;
88import { get , isEmpty } from 'lodash' ;
99import OSS from 'ali-oss' ;
10+ import { getContext } from './context' ;
1011
1112const buildAssets = ( rootPath : string , relativePath : string ) : Array < ISource > => {
1213 const location = path . resolve ( rootPath , relativePath ) ;
@@ -71,10 +72,11 @@ type ConstructedAsset = {
7172 objectKey : string ;
7273} ;
7374
74- export const constructAssets = async (
75- { files, rootPath } : CdkAssets ,
76- region : string ,
77- ) : Promise < Array < ConstructedAsset > | undefined > => {
75+ export const constructAssets = async ( {
76+ files,
77+ rootPath,
78+ } : CdkAssets ) : Promise < Array < ConstructedAsset > | undefined > => {
79+ const { region } = getContext ( ) ;
7880 const assets = await Promise . all (
7981 Object . entries ( files )
8082 . filter ( ( [ , fileItem ] ) => ! fileItem . source . path . endsWith ( '.template.json' ) )
@@ -112,15 +114,13 @@ const ensureBucketExits = async (bucketName: string, ossClient: OSS) =>
112114 }
113115 } ) ;
114116
115- export const publishAssets = async (
116- assets : Array < ConstructedAsset > | undefined ,
117- context : ActionContext ,
118- ) => {
117+ export const publishAssets = async ( assets : Array < ConstructedAsset > | undefined ) => {
119118 if ( ! assets ?. length ) {
120119 logger . info ( 'No assets to publish, skipped!' ) ;
121120 return ;
122121 }
123122
123+ const context = getContext ( ) ;
124124 const bucketName = assets [ 0 ] . bucketName ;
125125
126126 const client = new OSS ( {
@@ -148,15 +148,12 @@ export const publishAssets = async (
148148 return bucketName ;
149149} ;
150150
151- export const cleanupAssets = async (
152- assets : Array < ConstructedAsset > | undefined ,
153- context : ActionContext ,
154- ) => {
151+ export const cleanupAssets = async ( assets : Array < ConstructedAsset > | undefined ) => {
155152 if ( ! assets ?. length ) {
156153 logger . info ( 'No assets to cleanup, skipped!' ) ;
157154 return ;
158155 }
159-
156+ const context = getContext ( ) ;
160157 const bucketName = assets [ 0 ] . bucketName ;
161158
162159 const client = new OSS ( {
0 commit comments