-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Chocolatey package with zip not msi
- Loading branch information
1 parent
db74b7d
commit 129a1d1
Showing
6 changed files
with
126 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
################################################################################################### | ||
### THIS IS A REUSABLE WORKFLOW TO BUILD THE SCALA LAUNCHERS ### | ||
### HOW TO USE: ### | ||
### - THSI WORKFLOW WILL PACKAGE THE ALL THE LAUNCHERS AND UPLOAD THEM TO GITHUB ARTIFACTS ### | ||
### ### | ||
### NOTE: ### | ||
### - SEE THE WORFLOW FOR THE NAMES OF THE ARTIFACTS ### | ||
################################################################################################### | ||
|
||
|
||
name: Build Scala Launchers | ||
run-name: Build Scala Launchers | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Build and pack the SDK (universal) | ||
run : ./project/scripts/sbt dist/Universal/packageBin | ||
- name: Build and pack the SDK (linux x86-64) | ||
run : ./project/scripts/sbt dist-linux-x86_64/Universal/packageBin | ||
- name: Build and pack the SDK (linux aarch64) | ||
run : ./project/scripts/sbt dist-linux-aarch64/Universal/packageBin | ||
- name: Build and pack the SDK (mac x86-64) | ||
run : ./project/scripts/sbt dist-mac-x86_64/Universal/packageBin | ||
- name: Build and pack the SDK (mac aarch64) | ||
run : ./project/scripts/sbt dist-mac-aarch64/Universal/packageBin | ||
- name: Build and pack the SDK (win x86-64) | ||
run : ./project/scripts/sbt dist-win-x86_64/Universal/packageBin | ||
- name: Upload zip archive to GitHub Artifact (universal) | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
path: ./dist/target/universal/scala3-*.zip | ||
name: scala3.zip | ||
- name: Upload zip archive to GitHub Artifact (linux x86-64) | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
path: ./dist/linux-x86_64/target/universal/scala3-*-x86_64-pc-linux.zip | ||
name: scala3-x86_64-pc-linux.zip | ||
- name: Upload zip archive to GitHub Artifact (linux aarch64) | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
path: ./dist/linux-aarch64/target/universal/scala3-*-aarch64-pc-linux.zip | ||
name: scala3-aarch64-pc-linux.zip | ||
- name: Upload zip archive to GitHub Artifact (mac x86-64) | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
path: ./dist/mac-x86_64/target/universal/scala3-*-x86_64-apple-darwin.zip | ||
name: scala3-x86_64-apple-darwin.zip | ||
- name: Upload zip archive to GitHub Artifact (mac aarch64) | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
path: ./dist/mac-aarch64/target/universal/scala3-*-aarch64-apple-darwin.zip | ||
name: scala3-aarch64-apple-darwin.zip | ||
- name: Upload zip archive to GitHub Artifact (win x86-64) | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
path: ./dist/win-x86_64/target/universal/scala3-*-x86_64-pc-win32.zip | ||
name: scala3-x86_64-pc-win32.zip | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,31 @@ | ||
$ErrorActionPreference = 'Stop'; | ||
|
||
$unzipLocation = Split-Path -Parent $MyInvocation.MyCommand.Definition # Get the root of chocolatey folder | ||
$unzipLocation = Join-Path $unzipLocation "$($env:chocolateyPackageName)" # Append the package's name | ||
$unzipLocation = Join-Path $unzipLocation "$($env:chocolateyPackageVersion)" # Append the package's version | ||
|
||
# Configure the installation arguments | ||
$packageArgs = @{ | ||
packageName = 'scala' | ||
fileType = 'MSI' | ||
url64bit = '@LAUNCHER_URL@' | ||
Url64 = '@LAUNCHER_URL@' | ||
UnzipLocation = $unzipLocation | ||
} | ||
|
||
softwareName = 'Scala' | ||
Install-ChocolateyZipPackage @packageArgs | ||
|
||
silentArgs = "/qn /norestart" | ||
validExitCodes= @(0) | ||
$extractedDir = Get-ChildItem -Path $unzipLocation | Where-Object { $_.PSIsContainer } | Select-Object -First 1 | ||
|
||
if (-not $extractedDir) { | ||
throw "Failed to find the extracted directory." | ||
} | ||
|
||
Install-ChocolateyPackage @packageArgs | ||
# Define the bin path | ||
$scalaBinPath = Join-Path $unzipLocation $extractedDir | Join-Path -ChildPath 'bin' # Update this path if the structure inside the ZIP changes | ||
|
||
# Iterate through the .bat files in the bin directory and create shims | ||
Write-Host "Creating shims for .bat file from $scalaBinPath" | ||
Get-ChildItem -Path $scalaBinPath -Filter '*.bat' | ForEach-Object { | ||
$file = $_.FullName | ||
Write-Host "Creating shim for $file..." | ||
Install-BinFile -Name $_.BaseName -Path $file | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
$ErrorActionPreference = 'Stop'; | ||
|
||
$unzipLocation = Split-Path -Parent $MyInvocation.MyCommand.Definition # Get the root of chocolatey folder | ||
$unzipLocation = Join-Path $unzipLocation "$($env:chocolateyPackageName)" # Append the package's name | ||
$unzipLocation = Join-Path $unzipLocation "$($env:chocolateyPackageVersion)" # Append the package's version | ||
|
||
|
||
$extractedDir = Get-ChildItem -Path $unzipLocation | Where-Object { $_.PSIsContainer } | Select-Object -First 1 | ||
|
||
if (-not $extractedDir) { | ||
throw "Failed to find the extracted directory." | ||
} | ||
|
||
# Define the bin path | ||
$scalaBinPath = Join-Path $unzipLocation $extractedDir | Join-Path -ChildPath 'bin' # Update this path if the structure inside the ZIP changes | ||
|
||
# Iterate through the .bat files in the bin directory and remove shims | ||
Write-Host "Removing shims for .bat file from $scalaBinPath" | ||
Get-ChildItem -Path $scalaBinPath -Filter '*.bat' | ForEach-Object { | ||
$file = $_.FullName | ||
Write-Host "Removing shim for $file..." | ||
Uninstall-BinFile -Name $_.BaseName -Path $file | ||
} |