diff --git a/.ci/deploy.bat b/.ci/deploy.bat deleted file mode 100644 index 3461a9e07..000000000 --- a/.ci/deploy.bat +++ /dev/null @@ -1,29 +0,0 @@ -@ECHO OFF -SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION -cd .. -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 - -FOR /L %%i IN (1,1,10) DO ( - scp %archive% remote-server:autobuilds/development/ - IF ERRORLEVEL 1 ( - ECHO scp %archive% failed - attempt %%i/10 - ) ELSE ( - GOTO :doversion - ) -) - -:doversion - -set archive=versioninfo.txt -echo Dev build generated on %DATE:~10,4%-%DATE:~4,2%-%DATE:~7,2%, from git ^%GITHUB_SHA:~0,7%^ > %archive% - -FOR /L %%i IN (1,1,10) DO ( - scp %archive% remote-server:autobuilds/development/ - IF ERRORLEVEL 1 ( - ECHO scp %archive% failed - attempt %%i/10 - ) ELSE ( - EXIT /B 0 - ) -) diff --git a/.ci/deploy.ps1 b/.ci/deploy.ps1 new file mode 100644 index 000000000..2c447911d --- /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/.ci/deploy.sh b/.ci/deploy.sh index 9cfd56d57..f8b1c77cd 100755 --- a/.ci/deploy.sh +++ b/.ci/deploy.sh @@ -2,18 +2,13 @@ OS=$1 TZ=UTC now=`date +"%F-%H-%M-%S"` -filename="/tmp/qb64_${now}_`echo ${GITHUB_SHA} | sed 's/\(.......\).*$/\1/'`_$OS.tar.gz" +BUCKET=qb64-dev-builds +filename="/tmp/qb64_${now}_`echo ${GITHUB_SHA} | sed 's/\(.......\).*$/\1/'`_${OS}.tar.gz" cd .. tar --create --auto-compress --file ${filename} --exclude-from=qb64/.ci/common-exclusion.list --exclude-from=qb64/.ci/$OS-exclusion.list qb64 -# Send to server -# Sometimes the connection can be a bit flakey, so try multiple times on error -for i in `seq 1 10` -do scp ${filename} remote-server:autobuilds/development/ - if [ "$?" -eq 0 ] - then exit 0 - fi - echo scp $i failed +current_files=$(aws --output text --query 'Contents[].Key' s3api list-objects --bucket ${BUCKET} --prefix ${OS}) +aws s3 cp ${filename} s3://${BUCKET}/${OS}/ +for f in $current_files; do + aws s3 rm s3://${BUCKET}/$f done -exit 1 - diff --git a/.github/workflows/run.yml b/.github/workflows/run.yml index 3e345811d..992417df8 100644 --- a/.github/workflows/run.yml +++ b/.github/workflows/run.yml @@ -2,12 +2,11 @@ on: push: branches: - development - - ci-test jobs: linux-build: runs-on: ubuntu-latest - if: "contains(github.event.head_commit.message, 'ci-skip')" + if: "!contains(github.event.head_commit.message, 'ci-skip')" steps: - uses: actions/checkout@v2 - name: Install dependencies @@ -25,47 +24,40 @@ jobs: with: github_token: ${{ secrets.GITHUB_TOKEN }} branch: development - - name: Set deployment SSH key + - name: Setup aws if: github.event_name == 'push' - uses: shimataro/ssh-key-action@v2.1.0 + uses: aws-actions/configure-aws-credentials@v1 with: - key: ${{ secrets.SSH_KEY }} - # "qb64.org ssh-rsa AAAA" etc. - known_hosts: ${{ secrets.KNOWN_HOSTS }} - config: | - Host remote-server - HostName qb64.org - User m6rosupy1q2t - - name: Package and deploy + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: us-east-2 + - name: Publish to S3 if: github.event_name == 'push' run: .ci/deploy.sh lnx macos-build: runs-on: macos-latest - if: "contains(github.event.head_commit.message, 'ci-skip')" + if: "!contains(github.event.head_commit.message, 'ci-skip')" steps: - uses: actions/checkout@v2 - name: Bootstrap compiler run: .ci/bootstrap.sh osx - name: Compile run: .ci/compile.sh - - name: Set deployment SSH key + - name: Setup aws if: github.event_name == 'push' - uses: shimataro/ssh-key-action@v2.1.0 + uses: aws-actions/configure-aws-credentials@v1 with: - key: ${{ secrets.SSH_KEY }} - known_hosts: ${{ secrets.KNOWN_HOSTS }} - config: | - Host remote-server - HostName qb64.org - User m6rosupy1q2t - - name: Package and deploy + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: us-east-2 + - name: Publish to S3 if: github.event_name == 'push' run: .ci/deploy.sh osx windows-x86-build: runs-on: windows-latest - if: "contains(github.event.head_commit.message, 'ci-skip')" + if: "!contains(github.event.head_commit.message, 'ci-skip')" env: PLATFORM: x86 steps: @@ -74,19 +66,16 @@ jobs: run: .ci/bootstrap.bat - name: Compile run: .ci/compile.bat - - name: Set deployment SSH key + - name: Setup aws if: github.event_name == 'push' - uses: shimataro/ssh-key-action@v2.1.0 + uses: aws-actions/configure-aws-credentials@v1 with: - key: ${{ secrets.SSH_KEY }} - known_hosts: ${{ secrets.KNOWN_HOSTS }} - config: | - Host remote-server - HostName qb64.org - User m6rosupy1q2t - - name: Package and deploy + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + 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 @@ -95,35 +84,17 @@ jobs: PLATFORM: x64 steps: - uses: actions/checkout@v2 - #- name: Bootstrap compiler - #run: .ci/bootstrap.bat - #- name: Compile - #run: .ci/compile.bat - - name: Set deployment SSH key + - name: Bootstrap compiler + run: .ci/bootstrap.bat + - name: Compile + run: .ci/compile.bat + - name: Setup aws if: github.event_name == 'push' - uses: shimataro/ssh-key-action@v2.1.0 + uses: aws-actions/configure-aws-credentials@v1 with: - key: ${{ secrets.SSH_KEY }} - known_hosts: ${{ secrets.KNOWN_HOSTS }} - config: | - Host remote-server - HostName qb64.org - User m6rosupy1q2t - - name: Download - run: Invoke-WebRequest https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-windows-amd64.zip -OutFile ngrok.zip - - name: Extract - run: Expand-Archive ngrok.zip - - name: Auth - run: .\ngrok\ngrok.exe authtoken $Env:NGROK_AUTH_TOKEN - env: - NGROK_AUTH_TOKEN: ${{ secrets.NGROK_AUTH_TOKEN }} - - name: Enable TS - run: Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server'-name "fDenyTSConnections" -Value 0 - - run: Enable-NetFirewallRule -DisplayGroup "Remote Desktop" - - run: Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "UserAuthentication" -Value 1 - - run: Set-LocalUser -Name "runneradmin" -Password (ConvertTo-SecureString -AsPlainText "P@ssw0rd!" -Force) - - name: Create Tunnel - run: .\ngrok\ngrok.exe tcp 3389 - - name: Package and deploy + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: us-east-2 + - name: Publish to S3 if: github.event_name == 'push' - run: .ci/deploy.bat + run: .ci/deploy.ps1