File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed
Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,15 @@ name: Deploy QIT Docs
22
33on :
44 workflow_dispatch : # Allows manual triggering of the workflow.
5+ inputs :
6+ deploy_target :
7+ description : ' Deployment target'
8+ required : true
9+ default : ' staging'
10+ type : choice
11+ options :
12+ - staging
13+ - production
514 push :
615 branches :
716 - trunk
4453 env :
4554 DOCS_SECRET : ${{ secrets.DOCS_SECRET }}
4655 FILE : ${{ github.workspace }}/docs.zip
56+ DEPLOY_TARGET : ${{ github.event.inputs.deploy_target || (github.ref == 'refs/heads/trunk' && 'production' || 'staging') }}
Original file line number Diff line number Diff line change 1616 throw new RuntimeException ( sprintf ( "File %s does not exist " , getenv ( 'FILE ' ) ) );
1717}
1818
19+ // Determine deployment target
20+ $ deploy_target = getenv ( 'DEPLOY_TARGET ' ) ?: 'production ' ;
21+ $ deploy_urls = [
22+ 'production ' => 'https://qit.woo.com ' ,
23+ 'staging ' => 'https://stagingcompatibilitydashboard.wpcomstaging.com ' ,
24+ ];
25+
26+ if ( ! isset ( $ deploy_urls [ $ deploy_target ] ) ) {
27+ throw new RuntimeException ( sprintf ( "Invalid DEPLOY_TARGET '%s'. Must be 'production' or 'staging' " , $ deploy_target ) );
28+ }
29+
30+ $ deploy_url = $ deploy_urls [ $ deploy_target ];
31+ echo sprintf ( "🎯 Deploying to %s: %s \n" , $ deploy_target , $ deploy_url );
32+
1933$ file = new SplFileObject ( getenv ( 'FILE ' ) );
2034
2135$ chunk_size_bytes = 8 * 1024 * 1024 ; // 8mb
2741 $ current_chunk ++;
2842 $ curl = curl_init ();
2943 $ args = [
30- CURLOPT_URL => ' https://qit.woo.com ' ,
44+ CURLOPT_URL => $ deploy_url ,
3145 CURLOPT_POST => true ,
3246 CURLOPT_RETURNTRANSFER => true ,
3347 CURLOPT_FOLLOWLOCATION => true ,
You can’t perform that action at this time.
0 commit comments