Skip to content

Commit

Permalink
Add pack code for windows terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
daxgames committed Sep 25, 2023
1 parent ab10e83 commit ad21915
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 16 deletions.
31 changes: 29 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,34 @@ jobs:
working-directory: scripts
run: .\build.ps1 -Compile -verbose

- name: Pack the built files
- name: Pack the built files with Windows Terminal
shell: pwsh
working-directory: scripts
run: .\pack.ps1 -verbose
run: .\pack.ps1 -verbose -emulator windows-terminal

- name: Pack the built files with ConEmu
shell: pwsh
working-directory: scripts
run: .\pack.ps1 -verbose -emulator conemu

- name: Upload artifact (cmder_wt.zip)
uses: actions/upload-artifact@v3
with:
path: build/cmder_wt.zip
name: cmder_wt.zip
if-no-files-found: error

- name: Upload artifact (cmder_wt.7z)
uses: actions/upload-artifact@v3
with:
path: build/cmder_wt.7z
name: cmder_wt.7z

- name: Upload artifact (cmder_wt_mini.zip)
uses: actions/upload-artifact@v3
with:
path: build/cmder_wt_mini.zip
name: cmder_wt_mini.zip

- name: Upload artifact (cmder.zip)
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -82,8 +106,11 @@ jobs:
with:
files: |
build/cmder.zip
build/cmder_wt.zip
build/cmder.7z
build/cmder_wt.7z
build/cmder_mini.zip
build/cmder_wt_mini.zip
build/hashes.txt
draft: true
generate_release_notes: true
Expand Down
1 change: 1 addition & 0 deletions packignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ appveyor.yml
vendor\cmder.sh
vendor\git-prompt.sh
config\user-*
config\user_*
clink_history*
*.log
20 changes: 12 additions & 8 deletions scripts/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ Param(
# Using this option will skip all downloads, if you only need to build launcher
[switch]$noVendor,

# Using this option will specify the emulator to use [conemu-maximus5, or windows-terminal]
[string]$emulator = 'conemu-maximus5',
# Using this option will specify the emulator to use [all, conemu-maximus5, or windows-terminal]
[string]$emulator = 'all',

# Build launcher if you have MSBuild tools installed
[switch]$Compile
Expand Down Expand Up @@ -153,6 +153,16 @@ if (-not $noVendor) {
Download-File -Url $s.url -File $vend\$tempArchive -ErrorAction Stop
Extract-Archive $tempArchive $s.name

# Make Embedded Windows Terminal Portable
if ($s.name -eq "windows-terminal") {
$windowTerminalFiles = resolve-path ($saveTo + "\" + $s.name + "\terminal*")
move-item -ErrorAction SilentlyContinue $windowTerminalFiles\* $s.name >$null
remove-item -ErrorAction SilentlyContinue $windowTerminalFiles >$null
write-verbose "Making Windows Terminal Portable..."
New-Item -Type Directory -Path (Join-Path $saveTo "/windows-terminal/settings") -ErrorAction SilentlyContinue >$null
New-Item -Type File -Path (Join-Path $saveTo "/windows-terminal/.portable") -ErrorAction SilentlyContinue >$null
}

if ((Get-ChildItem $s.name).Count -eq 1) {
Flatten-Directory($s.name)
}
Expand All @@ -173,12 +183,6 @@ if (-not $noVendor) {
Copy-Item $WinTermSettingsJsonSave $WinTermSettingsJson
}

# Make Embedded Windows Terminal Portable
if ($emulator -eq "windows-terminal") {
New-Item -Type Directory -Path (Join-Path $saveTo "/windows-terminal/settings") -ErrorAction SilentlyContinue >$null
New-Item -Type leaf -Path (Join-Path $saveTo "/windows-terminal/.portable") -ErrorAction SilentlyContinue >$null
}

# Put vendor\cmder.sh in /etc/profile.d so it runs when we start bash or mintty
if ( (Test-Path $($saveTo + "git-for-windows/etc/profile.d") ) ) {
Write-Verbose "Adding cmder.sh /etc/profile.d"
Expand Down
14 changes: 8 additions & 6 deletions scripts/pack.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,16 @@ Ensure-Executable "7z"

if ($emulator -eq "windows-terminal") {
$targets = @{
"cmder_wt.7z" = "-t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -myx=7 -mqs=on";
"cmder_wt.zip" = "-mm=Deflate -mfb=128 -mpass=3";
"cmder_wt_mini.zip" = "-xr!`"vendor\git-for-windows`"";
"cmder_wt.7z" = "-t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -myx=7 -mqs=on -xr!`"vendor\conemu-maximus5`"";
"cmder_wt.zip" = "-mm=Deflate -mfb=128 -mpass=3 -xr!`"vendor\conemu-maximus5`"";
"cmder_wt_mini.zip" = "-xr!`"vendor\git-for-windows`" -xr!`"vendor\conemu-maximus5`"";
}
} else {
$targets = @{
"cmder.7z" = "-t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -myx=7 -mqs=on";
"cmder.zip" = "-mm=Deflate -mfb=128 -mpass=3";
"cmder_mini.zip" = "-xr!`"vendor\git-for-windows`"";
"cmder.7z" = "-t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -myx=7 -mqs=on -xr!`"vendor\windows-terminal`"";
"cmder.zip" = "-mm=Deflate -mfb=128 -mpass=3 -xr!`"vendor\windows-terminal`"";
"cmder_mini.zip" = "-xr!`"vendor\git-for-windows`" -xr!`"vendor\windows-terminal`"";
}
}

Push-Location -Path $cmderRoot
Expand Down

0 comments on commit ad21915

Please sign in to comment.