version: 0.2 env: variables: PROJECT: UnicornShopLegacy DOTNET_FRAMEWORK: 4.7.2 phases: install: commands: - '[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Find-PackageProvider -Name "Nuget" | Install-PackageProvider -Verbose -Force' - '[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Install-Module -Name AWS.Tools.S3 -Force' build: commands: - cd MonolithicApplication - nuget restore - cd src - msbuild $env:PROJECT.csproj /p:TargetFrameworkVersion=v$env:DOTNET_FRAMEWORK /p:Configuration=Release /p:DeployIisAppPath="Default Web Site" /p:PackageAsSingleFile=false /p:OutDir=C:\codebuild\artifacts\ /t:Package post_build: commands: - New-Item -Path "C:\" -Name "Archive" -ItemType "directory" - cd C:\Archive - 'Set-ItemProperty "HKLM:\System\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -value 1; Compress-Archive -Path \\?\C:\codebuild\artifacts\_PublishedWebsites\${env:PROJECT}_Package\Archive\* -DestinationPath C:\Archive\UnishopLegacy.zip' - Write-S3Object -BucketName $S3_BUCKET_NAME -File ".\UnishopLegacy.zip" -Region $MAIN_REGION -PublicReadOnly - Write-S3Object -BucketName $S3_BUCKET_NAME-$OTHER_REGION_1 -File ".\UnishopLegacy.zip" -Region $OTHER_REGION_1 -PublicReadOnly - Write-S3Object -BucketName $S3_BUCKET_NAME-$OTHER_REGION_2 -File ".\UnishopLegacy.zip" -Region $OTHER_REGION_2 -PublicReadOnly - Write-S3Object -BucketName $S3_BUCKET_NAME-$OTHER_REGION_3 -File ".\UnishopLegacy.zip" -Region $OTHER_REGION_3 -PublicReadOnly - Write-S3Object -BucketName $S3_BUCKET_NAME-$OTHER_REGION_4 -File ".\UnishopLegacy.zip" -Region $OTHER_REGION_4 -PublicReadOnly artifacts: files: - '**/*' base-directory: 'C:\codebuild\artifacts\_PublishedWebsites\${env:PROJECT}_Package\Archive\'