File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,6 +14,10 @@ inputs:
1414 TARGET_CLOUD_FORMATION_DEPLOY_ROLE :
1515 required : true
1616 description : " The role to assume for the target account"
17+ PURGE_ENVIRONMENT :
18+ required : false
19+ description : " Whether to remove all existing files in the target environment before syncing (true/false)"
20+ default : " false"
1721
1822runs :
1923 using : " composite"
7680 fi
7781 printf "\n"
7882
83+ - name : Clear Target Environment
84+ shell : bash
85+ run : |
86+ if [ "$PURGE_ENVIRONMENT" == "true" ]; then
87+ echo "Purging s3://${{ steps.find-destination-bucket.outputs.BUCKET_NAME }}..."
88+ aws s3 rm s3://${{ steps.find-destination-bucket.outputs.BUCKET_NAME }} --recursive
89+ else
90+ echo "Purge disabled. Skipping deletion of files in target bucket."
91+ exit 0
92+ fi
93+ printf "\n"
94+
7995 - name : Upload Files to Target S3
8096 shell : bash
8197 run : |
Original file line number Diff line number Diff line change @@ -199,14 +199,15 @@ jobs:
199199 env :
200200 TARGET_ENVIRONMENT : ${{ inputs.TARGET_ENVIRONMENT }}
201201
202- - name : Sync Documents - INT to lower environments
202+ - name : Sync Documents
203203 uses : ./.github/actions/sync_documents
204- if : ${{ (inputs.TARGET_ENVIRONMENT == 'dev' || inputs.TARGET_ENVIRONMENT == 'qa' || inputs.TARGET_ENVIRONMENT == 'dev-pr ') && (inputs.DEPLOY_CODE == true || inputs.IS_PULL_REQUEST == true) }}
204+ if : ${{ (inputs.TARGET_ENVIRONMENT != 'int ') && (inputs.DEPLOY_CODE == true || inputs.IS_PULL_REQUEST == true) }}
205205 with :
206206 TARGET_ENVIRONMENT : ${{ inputs.TARGET_ENVIRONMENT }}
207207 STACK : ${{ inputs.STACK_NAME }}
208208 INT_ASSIST_ME_DOCUMENT_SYNC_ROLE : ${{ secrets.INT_ASSIST_ME_DOCUMENT_SYNC_ROLE }}
209209 TARGET_CLOUD_FORMATION_DEPLOY_ROLE : ${{ secrets.CLOUD_FORMATION_DEPLOY_ROLE }}
210+ PURGE_ENVIRONMENT : ${{ inputs.TARGET_ENVIRONMENT == 'prod' }}
210211
211212 - name : create_int_release_notes
212213 uses : ./.github/actions/update_confluence_jira
Original file line number Diff line number Diff line change @@ -66,7 +66,9 @@ export class S3Bucket extends Construct {
6666 "s3:PutObjectLegalHold" ,
6767 "s3:PutObjectRetention" ,
6868 "s3:PutObjectTagging" ,
69- "s3:PutObjectVersionTagging"
69+ "s3:PutObjectVersionTagging" ,
70+ "s3:DeleteObject" ,
71+ "s3:DeleteObjectVersion"
7072 ] ,
7173 resources : [
7274 bucket . bucketArn ,
You can’t perform that action at this time.
0 commit comments