From b88724ef6ebc8478d164e9e350fa20769dd88f68 Mon Sep 17 00:00:00 2001 From: kerenr-jfrog Date: Mon, 16 Sep 2024 11:25:28 +0300 Subject: [PATCH] add script for downloading jfrog-cli --- .github/workflows/tests.yml | 19 ++++++++-------- .../Resources/DownloadJfrogCli.ps1 | 22 +++++++++++++++++++ 2 files changed, 31 insertions(+), 10 deletions(-) create mode 100644 JFrogVSExtension/Resources/DownloadJfrogCli.ps1 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 402d4fb..432474d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,9 +8,6 @@ on: jobs: build: runs-on: windows-latest - - env: - JFROG_CLI_VERSION: '2.67.0' steps: - name: Checkout code @@ -36,17 +33,19 @@ jobs: nuget-${{ runner.os }}- - name: Restore dependencies - run: dotnet restore + run: | + dotnet restore + nuget restore - name: Download JFrog CLI executable - - uses: jfrog/setup-jfrog-cli@v4 - with: - version: ${{ env.JFROG_CLI_VERSION }} + env: + JFROG_CLI_VERSION: ${{ env.JFROG_CLI_VERSION }} + run: | + .\JFrogVSExtension\Resources\DownloadJfrogCli.ps1 + shell: pwsh - - name: Build VSIX Project - # build the vsix project using multi-core compilation and parallel builds + - name: Build VSIX Project # build the vsix project using multi-core compilation and parallel builds run: msbuild ./JFrogVSExtension/ /p:Configuration=Release /p:Platform="AnyCPU" /p:BuildInParallel=true /m - - name: Run tests run: dotnet test --no-build --verbosity normal \ No newline at end of file diff --git a/JFrogVSExtension/Resources/DownloadJfrogCli.ps1 b/JFrogVSExtension/Resources/DownloadJfrogCli.ps1 new file mode 100644 index 0000000..3255f2e --- /dev/null +++ b/JFrogVSExtension/Resources/DownloadJfrogCli.ps1 @@ -0,0 +1,22 @@ +# Check if the JFROG_CLI_VERSION environment variable is set, if not using latest version +if (-not $env:JFROG_CLI_VERSION) { + Write-Output "Environment variable 'JFROG_CLI_VERSION' is not set. Using latest version as default." + $env:JFROG_CLI_VERSION = "[RELEASE]" +} + +# Define the URL for the JFrog CLI executable +$jfrogCliUrl = "https://releases.jfrog.io/artifactory/jfrog-cli/v2-jf/$($env:JFROG_CLI_VERSION)/jfrog-cli-windows-amd64/jf.exe" + +# Define the destination path for the downloaded file +$destinationPath = Join-Path (Get-Location).Path "JFrogVSExtension/Resources/jfrog.exe" + +# Download the JFrog CLI executable +Invoke-WebRequest -Uri $jfrogCliUrl -OutFile $destinationPath -Verbose + + +# Verify the file was downloaded successfully +if (Test-Path -Path $destinationPath) { + Write-Output "JFrog CLI v$env:JFROG_CLI_VERSION successfully downloaded to: $destinationPath" +} else { + Write-Output "Failed to download JFrog CLI to: $destinationPath" +}