Skip to content

Commit 7d644c5

Browse files
authored
feat: deb package scripts (#271)
1 parent 06e3a3c commit 7d644c5

File tree

6 files changed

+73
-9
lines changed

6 files changed

+73
-9
lines changed

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,15 @@
1212
# ecsact codegen
1313
*.ecsact.*
1414

15-
# MSIX distribution folder
15+
# Distribution files
1616
/dist/*
17+
18+
# MSIX distribution folder
1719
!/dist/AppxManifest.xml
1820
*.msix
1921
*.zip
22+
23+
# Debian distribution
24+
!/dist/DEBIAN
25+
*.deb
26+
*.tar.gz

CopyDist.ps1

100644100755
File mode changed.

CreateDeb.ps1

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env pwsh
2+
3+
param (
4+
[Parameter(Mandatory)] $Version
5+
)
6+
7+
$ErrorActionPreference = 'Stop'
8+
9+
$DebPath = "ecsact_sdk_$($Version)_amd64.deb"
10+
11+
try {
12+
((Get-Content -path ./dist/DEBIAN/control -Raw) -replace '0.0.0-placeholder',"$($Version)") | Set-Content -Path ./dist/DEBIAN/control
13+
rm -rf ./dist/images
14+
rm ./dist/AppxManifest.xml
15+
rm -f ./dist/bin/ecsact_rtb.runfiles/ecsact_cli/ecsact
16+
dpkg-deb --build --root-owner-group ./dist $DebPath
17+
} finally {
18+
git checkout ./dist/DEBIAN/control
19+
git checkout ./dist/AppxManifest.xml
20+
}
21+

DevInstall.ps1

100644100755
Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,25 @@ param (
77

88
$ErrorActionPreference = 'Stop'
99

10-
$ExistingPackage = Get-AppPackage EcsactSdk
11-
12-
if ($ExistingPackage) {
13-
Remove-AppPackage -Package $ExistingPackage.PackageFullName
14-
}
15-
1610
$GitTag = git describe --tags --abbrev=0
1711
$GitTagSplit = $GitTag.Split(".")
1812
$IncrementedVersion = $GitTagSplit[0] + "." + $GitTagSplit[1] + "." + (([int]$GitTagSplit[2]) + 1)
1913

2014
. .\CopyDist.ps1
21-
. .\CreateMsix.ps1 -Version $IncrementedVersion -CertPassword $CertPassword -CertPath $CertPath
2215

23-
Add-AppPackage -Path $MsixPath
16+
if ([System.Environment]::OSVersion.Platform -eq 'Unix') {
17+
# TODO(zaucy): Check if developer machine can install .deb files and give
18+
# a nice error if they can't.
19+
. ./CreateDeb.ps1 -Version $IncrementedVersion
20+
sudo dpkg -i $DebPath
21+
} else {
22+
$ExistingPackage = Get-AppPackage EcsactSdk
23+
24+
if ($ExistingPackage) {
25+
Remove-AppPackage -Package $ExistingPackage.PackageFullName
26+
}
27+
28+
. .\CreateMsix.ps1 -Version $IncrementedVersion -CertPassword $CertPassword -CertPath $CertPath
29+
Add-AppPackage -Path $MsixPath
30+
}
31+

UploadDeb.ps1

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env pwsh
2+
3+
$ErrorActionPreference = 'Stop'
4+
5+
# GitHub requires TLS 1.2
6+
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
7+
8+
$LatestTag = (gh release list -L 1).split()[0]
9+
Write-Host "Latest Tag: $LatestTag"
10+
11+
$ArchiveUrl = "https://github.com/ecsact-dev/ecsact_sdk/releases/download/$($LatestTag)/ecsact_sdk_$($LatestTag)_linux_x64.tar.gz"
12+
$ArchivePath = "ecsact_sdk_$($LatestTag)_linux_x64.tar.gz"
13+
14+
Write-Host "Downloading $ArchiveUrl to $ArchivePath..."
15+
Invoke-WebRequest $ArchiveUrl -OutFile $ArchivePath -UseBasicParsing
16+
17+
git clean dist -dfx
18+
Write-Host "Extracting $ArchivePath to dist..."
19+
tar -xf $ArchivePath -C dist
20+
21+
. .\CreateDeb.ps1 -Version $LatestTag
22+
gh release upload $LatestTag $DebPath --clobber
23+

dist/DEBIAN/control

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Package: ecsact-sdk
2+
Version: 0.0.0-placeholder
3+
Architecture: amd64
4+
Maintainer: Ezekiel Warren <ezekiel@seaube.com>
5+
Description: Ecsact SDK

0 commit comments

Comments
 (0)