From e7f4eeffad3dfcb2be8e42ff9a85423657808eea Mon Sep 17 00:00:00 2001 From: Luke Ceddia Date: Tue, 2 Feb 2021 22:39:11 +1100 Subject: [PATCH] Try some powershell --- .ci/deploy.bat | 13 ------------- .ci/deploy.ps1 | 11 +++++++++++ .github/workflows/run.yml | 2 +- 3 files changed, 12 insertions(+), 14 deletions(-) delete mode 100644 .ci/deploy.bat create mode 100644 .ci/deploy.ps1 diff --git a/.ci/deploy.bat b/.ci/deploy.bat deleted file mode 100644 index 4d3b2559c..000000000 --- a/.ci/deploy.bat +++ /dev/null @@ -1,13 +0,0 @@ -@ECHO OFF -SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION -cd .. -set BUCKET=qb64-dev-builds -set TIMEX=%TIME: =0% -set archive=qb64_%DATE:~10,4%-%DATE:~4,2%-%DATE:~7,2%-%TIMEX:~0,2%-%TIMEX:~3,2%-%TIMEX:~6,2%_%GITHUB_SHA:~0,7%_win-%PLATFORM%.7z -7z a -xr@qb64\.ci\common-exclusion.list -xr@qb64\.ci\win-exclusion.list %archive% qb64 - -aws --output text --query Contents[].Key s3api list-objects --bucket %BUCKET% --prefix win-%PLATFORM% > olddevbuilds.txt - -aws s3 cp %archive% s3://%BUCKET%/win-%PLATFORM%/ - -for /F "tokens=*" %%G in (olddevbuilds.txt) do aws s3 rm s3://%BUCKET%/%%G diff --git a/.ci/deploy.ps1 b/.ci/deploy.ps1 new file mode 100644 index 000000000..963dd9d77 --- /dev/null +++ b/.ci/deploy.ps1 @@ -0,0 +1,11 @@ +$Bucket = "qb64-dev-builds" +$Timestamp = (Get-Date).ToUniversalTime().ToString("yyyy-MM-dd-HH-mm-ss") +$Filename = "qb64_${Timestamp}_$($Env:GITHUB_SHA.substring(0,7))_win-${Env:PLATFORM}.7z" + +Set-Location .. +7z a -xr@qb64\.ci\common-exclusion.list -xr@qb64\.ci\win-exclusion.list $Filename qb64 +$OldFiles = aws --output json --query Contents[].Key s3api list-objects --bucket $Bucket --prefix win-$Env:PLATFORM | ConvertFrom-Json +aws s3 cp $Filename "s3://${Bucket}/win-${Env:PLATFORM}/" +foreach ($f in $OldFiles) { + aws s3 rm "s3://$Bucket/$f" +} \ No newline at end of file diff --git a/.github/workflows/run.yml b/.github/workflows/run.yml index 0738d73c4..b13f425ac 100644 --- a/.github/workflows/run.yml +++ b/.github/workflows/run.yml @@ -76,7 +76,7 @@ jobs: aws-region: us-east-2 - name: Publish to S3 if: github.event_name == 'push' - run: .ci/deploy.bat + run: .ci/deploy.ps1 windows-x64-build: runs-on: windows-latest