Skip to content

Commit 3e68241

Browse files
committed
EIM-192: update build workflow to upload .deb packages to new apt repository
EIM-192 added generating winget and scoop packages offline installer builder update Added man page to the eim deb package
1 parent bec22b3 commit 3e68241

File tree

4 files changed

+748
-9
lines changed

4 files changed

+748
-9
lines changed

.github/workflows/build.yaml

Lines changed: 355 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,44 @@ jobs:
178178
asset_path: release_cli/${{ matrix.package_name }}/offline_installer_builder.zip
179179
asset_name: offline_installer_builder-${{ matrix.package_name }}.zip
180180

181+
- name: Prepare manpage for deb package
182+
if: github.event_name == 'release' && github.event.action == 'created'
183+
run: |
184+
mkdir -p src-tauri/man
185+
cp man/eim.1 src-tauri/man/
186+
shell: bash
187+
188+
- name: Build CLI .deb package
189+
if: github.event_name == 'release' && github.event.action == 'created'
190+
run: |
191+
cd src-tauri
192+
# Install cargo-deb if not present
193+
cargo install cargo-deb || true
194+
# Build .deb with version from tag
195+
VERSION=$(echo ${{ github.ref_name }} | sed 's/v//')
196+
cargo deb --no-build --no-default-features --features cli \
197+
--target ${{ matrix.target || 'x86_64-unknown-linux-musl' }} \
198+
--deb-version $VERSION
199+
shell: bash
200+
201+
- name: Upload CLI .deb artifact
202+
if: github.event_name == 'release' && github.event.action == 'created'
203+
uses: actions/upload-artifact@v4
204+
with:
205+
name: eim-cli-${{ matrix.package_name }}-${{ github.run_number }}-deb
206+
path: src-tauri/target/debian/eim*.deb
207+
if-no-files-found: warn
208+
209+
- name: Upload CLI .deb Release Asset
210+
if: github.event_name == 'release' && github.event.action == 'created'
211+
uses: shogo82148/actions-upload-release-asset@v1
212+
env:
213+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
214+
with:
215+
upload_url: ${{ github.event.release.upload_url }}
216+
asset_path: src-tauri/target/debian/eim*.deb
217+
asset_name: eim-cli-${{ matrix.package_name }}.deb
218+
181219
build-cli:
182220
name: Build CLI (${{ matrix.package_name }})
183221
needs: [setup, build-test-lib]
@@ -940,3 +978,320 @@ jobs:
940978
git add Formula/eim.rb Casks/eim-gui.rb
941979
git commit -m "Update eim formula and cask to version ${{ steps.release-info.outputs.tag_name }}" || exit 0
942980
git push
981+
982+
uupdate-apt-repo:
983+
name: Update APT Repository on S3
984+
needs: [build-cli-linux, build-gui, update-release-info]
985+
runs-on: ubuntu-latest
986+
if: github.event_name == 'release' && github.event.action == 'created'
987+
steps:
988+
- name: Checkout repository
989+
uses: actions/checkout@v4
990+
991+
- name: Set up AWS credentials
992+
uses: aws-actions/configure-aws-credentials@v4
993+
with:
994+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
995+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
996+
aws-region: ap-east-1
997+
998+
- name: Install dependencies for APT repo tools
999+
run: |
1000+
sudo apt-get update
1001+
sudo apt-get install -y dpkg-dev apt-utils gzip
1002+
1003+
- name: Download GUI linux-x64 .deb artifact
1004+
uses: actions/download-artifact@v4
1005+
with:
1006+
name: eim-gui-linux-x64-${{ github.run_number }}-deb
1007+
path: new-debs/
1008+
1009+
- name: Download GUI linux-aarch64 .deb artifact
1010+
uses: actions/download-artifact@v4
1011+
with:
1012+
name: eim-gui-linux-aarch64-${{ github.run_number }}-deb
1013+
path: new-debs/
1014+
continue-on-error: true
1015+
1016+
- name: Download CLI linux-x64 .deb artifact
1017+
uses: actions/download-artifact@v4
1018+
with:
1019+
name: eim-cli-linux-x64-${{ github.run_number }}-deb
1020+
path: new-debs/
1021+
1022+
- name: Download CLI linux-aarch64 .deb artifact
1023+
uses: actions/download-artifact@v4
1024+
with:
1025+
name: eim-cli-linux-aarch64-${{ github.run_number }}-deb
1026+
path: new-debs/
1027+
continue-on-error: true
1028+
1029+
- name: Create proper APT repository structure
1030+
run: |
1031+
# Create proper directory structure
1032+
mkdir -p apt-repo/pool/main
1033+
mkdir -p apt-repo/dists/stable/main/binary-amd64
1034+
mkdir -p apt-repo/dists/stable/main/binary-arm64
1035+
1036+
# Sync existing .deb files from S3 pool
1037+
aws s3 sync s3://espdldata/dl/eim/apt/pool/main/ apt-repo/pool/main/ --exclude "*" --include "*.deb" || echo "No existing pool found"
1038+
1039+
# Copy new .deb files to pool
1040+
find new-debs -name "*.deb" -exec cp {} apt-repo/pool/main/ \; || echo "Warning: Some .deb files could not be copied"
1041+
1042+
# Debug: Show what's in the pool
1043+
echo "Pool contents:"
1044+
ls -la apt-repo/pool/main/
1045+
1046+
- name: Generate APT repository metadata
1047+
working-directory: apt-repo
1048+
run: |
1049+
# Generate Packages files for each architecture
1050+
# AMD64 packages
1051+
dpkg-scanpackages --arch amd64 pool/main > dists/stable/main/binary-amd64/Packages
1052+
gzip -k -f dists/stable/main/binary-amd64/Packages
1053+
1054+
# ARM64 packages
1055+
dpkg-scanpackages --arch arm64 pool/main > dists/stable/main/binary-arm64/Packages
1056+
gzip -k -f dists/stable/main/binary-arm64/Packages
1057+
1058+
# Generate Release file
1059+
cd dists/stable
1060+
cat > Release << EOF
1061+
Origin: Espressif Systems
1062+
Label: ESP-IDF Installation Manager
1063+
Suite: stable
1064+
Codename: stable
1065+
Architectures: amd64 arm64
1066+
Components: main
1067+
Description: ESP-IDF Installation Manager packages
1068+
Date: $(date -Ru)
1069+
EOF
1070+
1071+
# Add file hashes to Release
1072+
apt-ftparchive release . >> Release
1073+
1074+
echo "Generated Release file:"
1075+
cat Release
1076+
1077+
- name: Upload repository to S3
1078+
run: |
1079+
# Upload the entire repository structure
1080+
aws s3 sync apt-repo/ s3://espdldata/dl/eim/apt/ --acl public-read --delete
1081+
1082+
# Verify upload
1083+
echo "Uploaded repository structure:"
1084+
aws s3 ls s3://espdldata/dl/eim/apt/ --recursive
1085+
1086+
- name: Invalidate CloudFront cache
1087+
env:
1088+
DL_DISTRIBUTION_ID: ${{ secrets.DL_DISTRIBUTION_ID }}
1089+
run: |
1090+
aws cloudfront create-invalidation --distribution-id ${DL_DISTRIBUTION_ID} --paths "/dl/eim/apt/*"
1091+
1092+
generate-windows-packages:
1093+
name: Generate Windows Packages
1094+
needs: [build-cli, build-gui, update-release-info]
1095+
runs-on: windows-latest
1096+
if: github.event_name == 'release' && github.event.action == 'created'
1097+
steps:
1098+
- name: Checkout repository
1099+
uses: actions/checkout@v4
1100+
1101+
- name: Download CLI windows-x64 artifact
1102+
uses: actions/download-artifact@v4
1103+
with:
1104+
name: eim-cli-windows-x64-${{ github.run_number }}
1105+
path: artifacts/cli/
1106+
1107+
- name: Download GUI windows-x64 artifact
1108+
uses: actions/download-artifact@v4
1109+
with:
1110+
name: eim-gui-windows-x64-${{ github.run_number }}
1111+
path: artifacts/gui/
1112+
1113+
- name: Setup .NET 6.0
1114+
uses: actions/setup-dotnet@v4
1115+
with:
1116+
dotnet-version: '6.0.x'
1117+
1118+
- name: Generate Scoop manifests
1119+
shell: powershell
1120+
env:
1121+
VERSION: ${{ github.ref_name }}
1122+
run: |
1123+
$version = "${env:VERSION}".Replace('v','')
1124+
mkdir manifests-scoop -Force
1125+
1126+
# CLI Scoop manifest
1127+
$cliJson = @{
1128+
version = $version
1129+
description = "ESP-IDF CLI Manager"
1130+
homepage = "https://github.com/espressif/idf-im-ui"
1131+
license = "MIT"
1132+
architecture = @{
1133+
"64bit" = @{
1134+
url = "https://github.com/espressif/idf-im-ui/releases/download/${env:VERSION}/eim-cli-windows-x64.exe"
1135+
hash = (Get-FileHash artifacts/cli/eim.exe -Algorithm SHA256).Hash.ToLower()
1136+
bin = "eim.exe"
1137+
}
1138+
}
1139+
checkver = @{
1140+
github = "https://github.com/espressif/idf-im-ui"
1141+
}
1142+
autoupdate = @{
1143+
architecture = @{
1144+
"64bit" = @{
1145+
url = "https://github.com/espressif/idf-im-ui/releases/download/v`$version/eim-cli-windows-x64.exe"
1146+
}
1147+
}
1148+
}
1149+
} | ConvertTo-Json -Depth 10
1150+
$cliJson | Out-File -FilePath manifests-scoop/eim-cli.json -Encoding UTF8
1151+
1152+
# GUI Scoop manifest
1153+
$guiJson = @{
1154+
version = $version
1155+
description = "ESP-IDF GUI Manager"
1156+
homepage = "https://github.com/espressif/idf-im-ui"
1157+
license = "MIT"
1158+
architecture = @{
1159+
"64bit" = @{
1160+
url = "https://github.com/espressif/idf-im-ui/releases/download/${env:VERSION}/eim-gui-windows-x64.exe"
1161+
hash = (Get-FileHash artifacts/gui/eim.exe -Algorithm SHA256).Hash.ToLower()
1162+
bin = "eim.exe"
1163+
}
1164+
}
1165+
checkver = @{
1166+
github = "https://github.com/espressif/idf-im-ui"
1167+
}
1168+
autoupdate = @{
1169+
architecture = @{
1170+
"64bit" = @{
1171+
url = "https://github.com/espressif/idf-im-ui/releases/download/v`$version/eim-gui-windows-x64.exe"
1172+
}
1173+
}
1174+
}
1175+
} | ConvertTo-Json -Depth 10
1176+
$guiJson | Out-File -FilePath manifests-scoop/eim.json -Encoding UTF8
1177+
1178+
- name: Generate WinGet manifests
1179+
shell: powershell
1180+
env:
1181+
VERSION: ${{ github.ref_name }}
1182+
run: |
1183+
# Download WingetCreate
1184+
Invoke-WebRequest https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
1185+
1186+
$version = "${env:VERSION}".Replace('v','')
1187+
1188+
# Create CLI WinGet manifest files manually (simpler than using wingetcreate new)
1189+
mkdir -p winget-manifests/e/Espressif/eim-cli/$version -Force
1190+
1191+
# CLI Version manifest
1192+
@"
1193+
PackageIdentifier: Espressif.eim-cli
1194+
PackageVersion: $version
1195+
DefaultLocale: en-US
1196+
ManifestType: version
1197+
ManifestVersion: 1.6.0
1198+
"@ | Out-File -FilePath "winget-manifests/e/Espressif/eim-cli/$version/Espressif.eim-cli.yaml" -Encoding UTF8
1199+
1200+
# CLI Installer manifest
1201+
@"
1202+
PackageIdentifier: Espressif.eim-cli
1203+
PackageVersion: $version
1204+
Installers:
1205+
- Architecture: x64
1206+
InstallerType: exe
1207+
InstallerUrl: https://github.com/espressif/idf-im-ui/releases/download/${env:VERSION}/eim-cli-windows-x64.exe
1208+
InstallerSha256: $((Get-FileHash artifacts/cli/eim.exe -Algorithm SHA256).Hash.ToUpper())
1209+
InstallerSwitches:
1210+
Silent: /S
1211+
SilentWithProgress: /S
1212+
ManifestType: installer
1213+
ManifestVersion: 1.6.0
1214+
"@ | Out-File -FilePath "winget-manifests/e/Espressif/eim-cli/$version/Espressif.eim-cli.installer.yaml" -Encoding UTF8
1215+
1216+
# CLI Locale manifest
1217+
@"
1218+
PackageIdentifier: Espressif.eim-cli
1219+
PackageVersion: $version
1220+
PackageLocale: en-US
1221+
Publisher: Espressif Systems
1222+
PackageName: ESP-IDF Installer CLI
1223+
License: MIT
1224+
LicenseUrl: https://github.com/espressif/idf-im-ui/blob/master/LICENSE
1225+
ShortDescription: ESP-IDF CLI Manager
1226+
PackageUrl: https://github.com/espressif/idf-im-ui
1227+
ManifestType: defaultLocale
1228+
ManifestVersion: 1.6.0
1229+
"@ | Out-File -FilePath "winget-manifests/e/Espressif/eim-cli/$version/Espressif.eim-cli.locale.en-US.yaml" -Encoding UTF8
1230+
1231+
# Create GUI WinGet manifest files
1232+
mkdir -p winget-manifests/e/Espressif/eim/$version -Force
1233+
1234+
# GUI Version manifest
1235+
@"
1236+
PackageIdentifier: Espressif.eim
1237+
PackageVersion: $version
1238+
DefaultLocale: en-US
1239+
ManifestType: version
1240+
ManifestVersion: 1.6.0
1241+
"@ | Out-File -FilePath "winget-manifests/e/Espressif/eim/$version/Espressif.eim.yaml" -Encoding UTF8
1242+
1243+
# GUI Installer manifest
1244+
@"
1245+
PackageIdentifier: Espressif.eim
1246+
PackageVersion: $version
1247+
Installers:
1248+
- Architecture: x64
1249+
InstallerType: exe
1250+
InstallerUrl: https://github.com/espressif/idf-im-ui/releases/download/${env:VERSION}/eim-gui-windows-x64.exe
1251+
InstallerSha256: $((Get-FileHash artifacts/gui/eim.exe -Algorithm SHA256).Hash.ToUpper())
1252+
InstallerSwitches:
1253+
Silent: /S
1254+
SilentWithProgress: /S
1255+
ManifestType: installer
1256+
ManifestVersion: 1.6.0
1257+
"@ | Out-File -FilePath "winget-manifests/e/Espressif/eim/$version/Espressif.eim.installer.yaml" -Encoding UTF8
1258+
1259+
# GUI Locale manifest
1260+
@"
1261+
PackageIdentifier: Espressif.eim
1262+
PackageVersion: $version
1263+
PackageLocale: en-US
1264+
Publisher: Espressif Systems
1265+
PackageName: ESP-IDF Installer GUI
1266+
License: MIT
1267+
LicenseUrl: https://github.com/espressif/idf-im-ui/blob/master/LICENSE
1268+
ShortDescription: ESP-IDF GUI Manager
1269+
PackageUrl: https://github.com/espressif/idf-im-ui
1270+
ManifestType: defaultLocale
1271+
ManifestVersion: 1.6.0
1272+
"@ | Out-File -FilePath "winget-manifests/e/Espressif/eim/$version/Espressif.eim.locale.en-US.yaml" -Encoding UTF8
1273+
1274+
- name: Upload to GitHub Release
1275+
env:
1276+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1277+
run: |
1278+
# Create archives of the WinGet manifests
1279+
7z a winget-manifests.zip winget-manifests/*
1280+
gh release upload ${{ github.ref_name }} winget-manifests.zip manifests-scoop/*.json
1281+
shell: bash
1282+
1283+
- name: Update Scoop bucket (if you have a dedicated repo)
1284+
if: false # disabled by default; set to true to enable
1285+
env:
1286+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1287+
SCOOP_REPO: espressif/eim-scoop
1288+
run: |
1289+
git clone https://github.com/espressif/eim-scoop.git scoop-bucket
1290+
Copy-Item manifests-scoop/*.json scoop-bucket/bucket/
1291+
cd scoop-bucket
1292+
git config user.name "GitHub Action"
1293+
git config user.email "[email protected]"
1294+
git add bucket/*.json
1295+
git commit -m "Update eim to ${{ github.ref_name }}" || exit 0
1296+
git push
1297+
shell: bash

0 commit comments

Comments
 (0)