Skip to content

Commit

Permalink
add script for downloading jfrog-cli
Browse files Browse the repository at this point in the history
  • Loading branch information
kerenr-jfrog committed Sep 16, 2024
1 parent 7cf98ed commit b88724e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 10 deletions.
19 changes: 9 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ on:
jobs:
build:
runs-on: windows-latest

env:
JFROG_CLI_VERSION: '2.67.0'

steps:
- name: Checkout code
Expand All @@ -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
22 changes: 22 additions & 0 deletions JFrogVSExtension/Resources/DownloadJfrogCli.ps1
Original file line number Diff line number Diff line change
@@ -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"
}

0 comments on commit b88724e

Please sign in to comment.