Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,7 @@ jobs:
shell: pwsh
run: |
[scriptblock]::Create((Get-Content -Raw azure/bootstrap.ps1)) > $null
[scriptblock]::Create((Get-Content -Raw gitlab/bootstrap.ps1)) > $null

build:
runs-on: ubuntu-latest
Expand Down
100 changes: 72 additions & 28 deletions README.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions azure/bootstrap.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ foreach ($chunkName in $chunkNames) {
}

& node $runtimeOut prepare
if ($LASTEXITCODE -ne 0) { throw "setup-vp prepare failed with exit code $LASTEXITCODE" }
47 changes: 40 additions & 7 deletions azure/setup-vp.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
parameters:
- name: version
type: string
default: latest
default: ""
- name: versionFile
type: string
default: ""
- name: nodeVersionFile
type: string
default: ""
- name: bootstrapNodeVersion
type: string
default: 24.x
- name: stepName
type: string
default: setupVp
- name: workingDirectory
type: string
default: .
Expand All @@ -14,6 +26,9 @@ parameters:
- name: registryUrl
type: string
default: ""
- name: authEnv
type: object
default: {}
- name: scope
type: string
default: ""
Expand All @@ -22,7 +37,7 @@ parameters:
default: v1.20.0
- name: nodeVersion
type: string
default: 24.x
default: ""
- name: packageManager
type: object
default: ""
Expand All @@ -37,11 +52,11 @@ parameters:
default: ""

steps:
- ${{ if ne(parameters.nodeVersion, '') }}:
- ${{ if ne(parameters.bootstrapNodeVersion, '') }}:
- task: UseNode@1
displayName: Use Node.js
displayName: Use bootstrap Node.js
inputs:
version: ${{ parameters.nodeVersion }}
version: ${{ parameters.bootstrapNodeVersion }}

- powershell: |
$ErrorActionPreference = 'Stop'
Expand All @@ -53,6 +68,9 @@ steps:
displayName: setup-vp prepare (Windows)
env:
SETUP_VP_VERSION: ${{ parameters.version }}
SETUP_VP_VERSION_FILE: ${{ parameters.versionFile }}
SETUP_VP_NODE_VERSION: ${{ parameters.nodeVersion }}
SETUP_VP_NODE_VERSION_FILE: ${{ parameters.nodeVersionFile }}
SETUP_VP_WORKING_DIRECTORY: ${{ parameters.workingDirectory }}
SETUP_VP_RUN_INSTALL: ${{ convertToJson(parameters.runInstall) }}
SETUP_VP_SFW: ${{ iif(eq(parameters.sfw, true), 'true', 'false') }}
Expand All @@ -76,6 +94,9 @@ steps:
displayName: setup-vp prepare (Unix)
env:
SETUP_VP_VERSION: ${{ parameters.version }}
SETUP_VP_VERSION_FILE: ${{ parameters.versionFile }}
SETUP_VP_NODE_VERSION: ${{ parameters.nodeVersion }}
SETUP_VP_NODE_VERSION_FILE: ${{ parameters.nodeVersionFile }}
SETUP_VP_WORKING_DIRECTORY: ${{ parameters.workingDirectory }}
SETUP_VP_RUN_INSTALL: ${{ convertToJson(parameters.runInstall) }}
SETUP_VP_SFW: ${{ iif(eq(parameters.sfw, true), 'true', 'false') }}
Expand All @@ -88,6 +109,14 @@ steps:
SETUP_VP_CACHE_DEPENDENCY_PATH: ${{ parameters.cacheDependencyPath }}
SETUP_VP_RUNTIME_OUT: $(Agent.TempDirectory)/setup-vp-azure/dist/azure/index.mjs

- ${{ if eq(parameters.sfw, true) }}:
- task: Cache@2
displayName: Cache Socket Firewall Free
condition: and(succeeded(), eq(variables['SETUP_VP_SFW_READY'], 'true'))
inputs:
key: '"setup-vp-sfw" | "$(SETUP_VP_SFW_CACHE_KEY)"'
path: $(SETUP_VP_SFW_CACHE_DIR)

- ${{ if eq(parameters.cache, true) }}:
- task: Cache@2
displayName: Cache Vite+ package-manager data
Expand All @@ -102,9 +131,10 @@ steps:

- powershell: |
$ErrorActionPreference = 'Stop'
node "$(Agent.TempDirectory)\setup-vp-azure\dist\azure\index.mjs" finalize
& "$(SETUP_VP_BOOTSTRAP_NODE)" "$(Agent.TempDirectory)\setup-vp-azure\dist\azure\index.mjs" finalize
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
displayName: setup-vp finalize (Windows)
name: ${{ parameters.stepName }}Windows
env:
SETUP_VP_VERSION: ${{ parameters.version }}
SETUP_VP_WORKING_DIRECTORY: ${{ parameters.workingDirectory }}
Expand All @@ -113,14 +143,16 @@ steps:
SETUP_VP_REGISTRY_URL: ${{ parameters.registryUrl }}
SETUP_VP_SCOPE: ${{ parameters.scope }}
NODE_AUTH_TOKEN: $(NODE_AUTH_TOKEN)
${{ insert }}: ${{ parameters.authEnv }}
SETUP_VP_CACHE: ${{ iif(eq(parameters.cache, true), 'true', 'false') }}
SETUP_VP_CACHE_DEPENDENCY_PATH: ${{ parameters.cacheDependencyPath }}

- bash: |
set -euo pipefail
node "$(Agent.TempDirectory)/setup-vp-azure/dist/azure/index.mjs" finalize
"$(SETUP_VP_BOOTSTRAP_NODE)" "$(Agent.TempDirectory)/setup-vp-azure/dist/azure/index.mjs" finalize
condition: and(succeeded(), ne(variables['Agent.OS'], 'Windows_NT'))
displayName: setup-vp finalize (Unix)
name: ${{ parameters.stepName }}Unix
env:
SETUP_VP_VERSION: ${{ parameters.version }}
SETUP_VP_WORKING_DIRECTORY: ${{ parameters.workingDirectory }}
Expand All @@ -129,5 +161,6 @@ steps:
SETUP_VP_REGISTRY_URL: ${{ parameters.registryUrl }}
SETUP_VP_SCOPE: ${{ parameters.scope }}
NODE_AUTH_TOKEN: $(NODE_AUTH_TOKEN)
${{ insert }}: ${{ parameters.authEnv }}
SETUP_VP_CACHE: ${{ iif(eq(parameters.cache, true), 'true', 'false') }}
SETUP_VP_CACHE_DEPENDENCY_PATH: ${{ parameters.cacheDependencyPath }}
64 changes: 37 additions & 27 deletions dist/azure/index.mjs

Large diffs are not rendered by default.

87 changes: 67 additions & 20 deletions dist/gitlab/index.mjs

Large diffs are not rendered by default.

138 changes: 70 additions & 68 deletions dist/index.mjs

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions gitlab/bootstrap.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
$ErrorActionPreference = 'Stop'
$runtimeNode = (Get-Command node -ErrorAction Stop).Source
$setupRef = if ($env:SETUP_VP_SETUP_REF) { $env:SETUP_VP_SETUP_REF } else { 'v1' }
$runtime = Join-Path ([IO.Path]::GetTempPath()) ("setup-vp-gitlab-" + [guid]::NewGuid() + ".mjs")
try {
$url = "https://raw.githubusercontent.com/voidzero-dev/setup-vp/$setupRef/dist/gitlab/index.mjs"
Invoke-WebRequest -Uri $url -OutFile $runtime -TimeoutSec 60
& $runtimeNode $runtime
if ($LASTEXITCODE -ne 0) { throw "setup-vp failed with exit code $LASTEXITCODE" }
} finally {
Remove-Item -LiteralPath $runtime -Force -ErrorAction SilentlyContinue
}
Loading
Loading