@@ -13,6 +13,7 @@ const RELEASE_JOB = 'release';
1313const PREPARE_RESOURCES_RUN = / p n p m r u n p r e p a r e : r e s o u r c e s / ;
1414const PRESIGN_BACKEND_RUN = / c o d e s i g n - m a c o s - n e s t e d \. s h \s + " r e s o u r c e s \/ b a c k e n d " / ;
1515const BUILD_APP_BUNDLE_RUN = / c a r g o t a u r i b u i l d - - v e r b o s e - - t a r g e t / ;
16+ const IMPORT_APPLE_CERTIFICATE_RUN = / s e c u r i t y i m p o r t " \$ C E R T _ P A T H " / ;
1617
1718test ( 'findStep supports predicate and regex matching' , ( ) => {
1819 const steps = [
@@ -70,6 +71,32 @@ test('macOS workflow prepares resources before optional pre-signing', async () =
7071 ) ;
7172} ) ;
7273
74+ test ( 'macOS workflow requires one certificate and derives its team ID' , async ( ) => {
75+ const workflowObject = await readWorkflowObject ( WORKFLOW_FILE ) ;
76+ const steps = extractWorkflowJobSteps ( workflowObject , BUILD_MACOS_JOB ) ;
77+ const importStep = findStep (
78+ steps ,
79+ 'Import Apple Developer Certificate' ,
80+ ( step ) => IMPORT_APPLE_CERTIFICATE_RUN . test ( step . run ?? '' ) ,
81+ ) ;
82+ const buildStep = findStep (
83+ steps ,
84+ 'Build desktop app bundle (macOS)' ,
85+ ( step ) => BUILD_APP_BUNDLE_RUN . test ( step . run ?? '' ) ,
86+ ) ;
87+
88+ assert . equal ( importStep . env ?. APPLE_CERTIFICATE , '${{ secrets.APPLE_CERTIFICATE }}' ) ;
89+ assert . equal ( importStep . env ?. APPLE_CERTIFICATE_PASSWORD , '${{ secrets.APPLE_CERTIFICATE_PASSWORD }}' ) ;
90+ assert . match ( importStep . run , / A P P L E _ C E R T I F I C A T E i s r e q u i r e d f o r m a c O S r e l e a s e b u i l d s / ) ;
91+ assert . match ( importStep . run , / A P P L E _ C E R T I F I C A T E _ P A S S W O R D i s r e q u i r e d f o r m a c O S r e l e a s e b u i l d s / ) ;
92+ assert . match ( importStep . run , / E x p e c t e d e x a c t l y o n e D e v e l o p e r I D A p p l i c a t i o n i d e n t i t y / ) ;
93+ assert . match ( importStep . run , / o p e n s s l x 5 0 9 - n o o u t - s u b j e c t - n a m e o p t R F C 2 2 5 3 / ) ;
94+ assert . match ( importStep . run , / A P P L E _ T E A M _ I D = % s / ) ;
95+ assert . equal ( buildStep . env ?. APPLE_CERTIFICATE , undefined ) ;
96+ assert . equal ( buildStep . env ?. APPLE_CERTIFICATE_PASSWORD , undefined ) ;
97+ assert . equal ( buildStep . env ?. APPLE_TEAM_ID , undefined ) ;
98+ } ) ;
99+
73100test ( 'release workflow disables generated release notes for nightly builds' , async ( ) => {
74101 const workflowObject = await readWorkflowObject ( WORKFLOW_FILE ) ;
75102 const steps = extractWorkflowJobSteps ( workflowObject , RELEASE_JOB ) ;
0 commit comments