-
Notifications
You must be signed in to change notification settings - Fork 15
/
fetch-source.ps1
27 lines (21 loc) · 1 KB
/
fetch-source.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Get version from package.json
$version = (Get-Content "package.json" -Raw | ConvertFrom-Json).version
# Remove dist directory if it exists and create a new one
if(Test-Path -Path dist) {
Remove-Item -Path dist -Recurse -Force
}
New-Item -ItemType Directory -Path dist | Out-Null
# Remove allure-commandline.zip if it exists
if(Test-Path -Path allure-commandline.zip) {
Remove-Item -Path allure-commandline.zip -Force
}
# Download allure-commandline.zip from Maven repository
Invoke-WebRequest -Uri "https://repo.maven.apache.org/maven2/io/qameta/allure/allure-commandline/$version/allure-commandline-$version.zip" -OutFile allure-commandline.zip
# Extract allure-commandline.zip to dist directory
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::ExtractToDirectory('allure-commandline.zip', 'dist')
# Same as --strip-components=1 of tar
Move-Item "dist\allure-$version\*" "dist"
Remove-Item "dist\allure-$version\*"
# List files in current directory
Get-ChildItem -Path .