From 1708e00f118ecf6071771f4fcacacd331036f1c4 Mon Sep 17 00:00:00 2001 From: Stjepan Bakrac Date: Sun, 3 Nov 2024 23:51:17 +0900 Subject: [PATCH] CI: Updated to new Windower API (#509) --- .github/scripts/deploy.ps1 | 14 -------- .github/workflows/ci.yml | 65 ++++++++++++-------------------------- 2 files changed, 20 insertions(+), 59 deletions(-) delete mode 100644 .github/scripts/deploy.ps1 diff --git a/.github/scripts/deploy.ps1 b/.github/scripts/deploy.ps1 deleted file mode 100644 index 6af36cb1..00000000 --- a/.github/scripts/deploy.ps1 +++ /dev/null @@ -1,14 +0,0 @@ -$repo = ($env:GITHUB_REPOSITORY -Split '/')[1] ?? $env:GITHUB_REPOSITORY -&ssh "${env:SSH_USER}@${env:SSH_HOST}" (@( - "rm -rf ~/staging/${repo}", - "mkdir -p ~/staging/${repo}" -) -Join '&&') -&scp -r './.staging/*' "${env:SSH_USER}@${env:SSH_HOST}:~/staging/${repo}" -&ssh "${env:SSH_USER}@${env:SSH_HOST}" (@( - "rm -rf ~/backup/" - "mkdir ~/backup/" - "mv ${env:FILES_PATH}/* ~/backup/", - "mv ~/staging/${repo}/* ${env:FILES_PATH}/", - "rm -r ~/backup/" - "rm -r ~/staging/${repo}" -) -Join '&&') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 62c6678e..daf15ec0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,10 +1,10 @@ -name: Build +name: Build; on: push: - branches: master + branches: ["master"] pull_request: - branches: master + branches: ["master"] defaults: run: @@ -13,7 +13,7 @@ defaults: jobs: manifest_check: name: Validate Manifest - runs-on: windows-2019 + runs-on: windows-latest steps: - name: Checkout uses: actions/checkout@v2 @@ -21,7 +21,7 @@ jobs: run: .github/scripts/check-manifests syntax_check: name: Validate Syntax - runs-on: windows-2019 + runs-on: windows-latest steps: - name: Checkout uses: actions/checkout@v2 @@ -34,7 +34,7 @@ jobs: run: .github/scripts/check-syntax license_check: name: Validate License Text - runs-on: windows-2019 + runs-on: windows-latest steps: - name: Checkout uses: actions/checkout@v2 @@ -42,7 +42,7 @@ jobs: run: .github/scripts/check-license version_check: name: Check Version - runs-on: windows-2019 + runs-on: windows-latest if: github.event_name == 'pull_request' steps: - name: Checkout @@ -53,54 +53,29 @@ jobs: run: .github/scripts/check-versions build: name: Build - runs-on: windows-2019 + runs-on: windows-latest steps: - name: Set up environment uses: microsoft/setup-msbuild@v1.0.2 - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Stage files run: .github/scripts/stage-files - name: Build native binaries run: .github/scripts/build-native-binaries - name: Build package index run: .github/scripts/build-package-index - - name: Upload build artifacts + - name: Check out API repo if: github.event_name == 'push' - uses: actions/upload-artifact@v2 + uses: actions/checkout@v4 with: - name: packages - path: .staging - deploy: - name: Deploy - needs: build - runs-on: windows-2019 - if: github.event_name == 'push' - steps: - - name: Set up environment - run: | - # Set up environment - Write-Output 'Starting ssh-agent service...' - Get-Service -Name 'ssh-agent' | Set-Service -StartupType Manual - Start-Service -Name 'ssh-agent' - New-Item -ItemType Directory -Force -Path '~/.ssh' *>$null - $env:SSH_KEY | &ssh-add - - &ssh-keyscan -H "$( - @($env:SSH_HOST) + (Resolve-DnsName $env:SSH_HOST).IPAddress -Join ',' - )" | Add-Content '~/.ssh/known_hosts' - env: - SSH_HOST: ${{ secrets.SSH_HOST }} - SSH_KEY: ${{ secrets.SSH_KEY }} - - name: Checkout - uses: actions/checkout@v2 - - name: Download build artifacts - uses: actions/download-artifact@v2 + repository: Windower/Api + path: .api + - name: Upload artifacts to Windower server + if: github.event_name == 'push' + uses: ./.api/.github/actions/upload with: - name: packages - path: .staging - - name: Deploy to server - run: .github/scripts/deploy - env: - SSH_HOST: ${{ secrets.SSH_HOST }} - SSH_USER: ${{ secrets.SSH_USER }} - FILES_PATH: ${{ secrets.FILES_PATH }} + url: https://api.windower.net/gh + api-key: ${{secrets.WINDOWER_SERVER_API_KEY}} + repository: ${{github.event.repository.name}} + directory: .staging