Skip to content

Commit de08b7e

Browse files
author
dak
committed
feat: add beta channel publishing and package
1 parent cc024e7 commit de08b7e

7 files changed

Lines changed: 157 additions & 34 deletions

File tree

.github/workflows/sync-ppa.yml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ on:
99
description: Optional upstream tag to package
1010
required: false
1111
type: string
12+
channel:
13+
description: Release channel to package
14+
required: false
15+
default: stable
16+
type: choice
17+
options:
18+
- stable
19+
- beta
1220
ppa_revision:
1321
description: PPA revision suffix
1422
required: false
@@ -43,11 +51,13 @@ jobs:
4351
- name: Determine upstream tag
4452
id: upstream
4553
run: |
54+
channel="${{ inputs.channel || 'stable' }}"
4655
if [[ -n "${{ inputs.release_tag }}" ]]; then
4756
tag="${{ inputs.release_tag }}"
4857
else
49-
tag="$(./scripts/get-latest-release-tag.sh stable)"
58+
tag="$(./scripts/get-latest-release-tag.sh "$channel")"
5059
fi
60+
echo "channel=$channel" >> "$GITHUB_OUTPUT"
5161
echo "tag=$tag" >> "$GITHUB_OUTPUT"
5262
5363
- name: Resolve workflow settings
@@ -66,7 +76,8 @@ jobs:
6676
- name: Check whether upload is needed
6777
id: state
6878
run: |
69-
recorded="$(tr -d '\n' < state/latest-stable-tag.txt || true)"
79+
marker_file="state/latest-${{ steps.upstream.outputs.channel }}-tag.txt"
80+
recorded="$(tr -d '\n' < "$marker_file" || true)"
7081
force=false
7182
if [[ "${{ github.event_name }}" == "workflow_dispatch" && -n "${{ inputs.release_tag }}" ]]; then
7283
force=true
@@ -98,6 +109,7 @@ jobs:
98109
PPA_REVISION: ${{ steps.settings.outputs.revision }}
99110
SOURCE_INCLUDE_MODE: auto
100111
SERIES_OVERRIDE: ${{ inputs.series }}
112+
CHANNEL: ${{ steps.upstream.outputs.channel }}
101113
DEBFULLNAME: daddyparodz
102114
DEBEMAIL: 45983094+daddyparodz@users.noreply.github.com
103115
run: |
@@ -112,7 +124,7 @@ jobs:
112124
export DEBSIGN_KEYID="${LAUNCHPAD_GPG_FINGERPRINT}"
113125
args+=(--sign)
114126
fi
115-
./scripts/build-source-package.sh "${args[@]}"
127+
./scripts/build-source-package.sh --channel "$CHANNEL" "${args[@]}"
116128
117129
- name: Validate generated source and binary payloads
118130
if: steps.state.outputs.skip != 'true'
@@ -135,11 +147,12 @@ jobs:
135147
if: steps.state.outputs.skip != 'true' && steps.settings.outputs.upload == 'true' && success() && github.ref == 'refs/heads/main'
136148
continue-on-error: true
137149
run: |
138-
printf '%s\n' "${{ steps.upstream.outputs.tag }}" > state/latest-stable-tag.txt
150+
marker_file="state/latest-${{ steps.upstream.outputs.channel }}-tag.txt"
151+
printf '%s\n' "${{ steps.upstream.outputs.tag }}" > "$marker_file"
139152
git config user.name "github-actions[bot]"
140153
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
141-
git add state/latest-stable-tag.txt
142-
git commit -m "chore: record packaged release ${{ steps.upstream.outputs.tag }}" || exit 0
154+
git add "$marker_file"
155+
git commit -m "chore: record ${{ steps.upstream.outputs.channel }} packaged release ${{ steps.upstream.outputs.tag }}" || exit 0
143156
git push
144157
145158
- name: Cleanup old workflow artifacts

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ sudo apt update
1818
sudo apt install bambustudio
1919
```
2020

21+
## Install Beta
22+
23+
```bash
24+
sudo add-apt-repository ppa:daddyparodz/bambustudio
25+
sudo apt update
26+
sudo apt install bambustudio-beta
27+
```
28+
2129
## Included
2230

2331
- Ubuntu packages built from the official Bambu Lab Linux releases
@@ -35,6 +43,7 @@ sudo apt upgrade
3543

3644
```bash
3745
sudo apt remove bambustudio
46+
sudo apt remove bambustudio-beta
3847
sudo add-apt-repository --remove ppa:daddyparodz/bambustudio
3948
```
4049

packaging/debian/control

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Source: bambustudio
1+
Source: @SOURCE_PACKAGE_NAME@
22
Section: graphics
33
Priority: optional
44
Maintainer: daddyparodz <45983094+daddyparodz@users.noreply.github.com>
@@ -9,7 +9,7 @@ Homepage: https://github.com/bambulab/BambuStudio
99
Vcs-Browser: https://github.com/daddyparodz/bambustudio
1010
Vcs-Git: https://github.com/daddyparodz/bambustudio.git
1111

12-
Package: bambustudio
12+
Package: @BINARY_PACKAGE_NAME@
1313
Architecture: amd64
1414
Depends: ${misc:Depends}, libfuse2t64 | libfuse2, desktop-file-utils, xdg-utils
1515
Description: Bambu Studio repackaged from the official Linux AppImage

packaging/debian/rules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ override_dh_auto_test:
1111

1212
override_dh_fixperms:
1313
dh_fixperms
14-
chmod 0755 debian/bambustudio/opt/bambustudio/BambuStudio.AppImage
14+
find debian -type f -path '*/opt/*/BambuStudio.AppImage' -exec chmod 0755 {} +
1515

1616
override_dh_strip:
1717
# AppImage is an ELF launcher with an appended squashfs payload.

scripts/build-source-package.sh

Lines changed: 109 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ PPA_REVISION="${PPA_REVISION:-1}"
1515
SIGN_SOURCE="${SIGN_SOURCE:-0}"
1616
SOURCE_INCLUDE_MODE="${SOURCE_INCLUDE_MODE:-auto}"
1717
REUSE_EXISTING_ORIG="${REUSE_EXISTING_ORIG:-1}"
18-
PPA_ORIG_BASE_URL="${PPA_ORIG_BASE_URL:-https://ppa.launchpadcontent.net/daddyparodz/bambustudio/ubuntu/pool/main/b/bambustudio}"
18+
PPA_ORIG_BASE_URL="${PPA_ORIG_BASE_URL:-}"
1919
MAINTAINER_NAME="${MAINTAINER_NAME:-daddyparodz}"
2020
MAINTAINER_EMAIL="${MAINTAINER_EMAIL:-45983094+daddyparodz@users.noreply.github.com}"
2121

@@ -116,15 +116,34 @@ else
116116
CHANGELOG_DATE="$(date -Ru -d "$PUBLISHED_AT")"
117117
fi
118118

119+
SOURCE_PACKAGE_NAME="bambustudio"
120+
BINARY_PACKAGE_NAME="bambustudio"
121+
INSTALL_DIR="/opt/bambustudio"
122+
WRAPPER_CMD="bambustudio"
123+
DESKTOP_FILE="bambustudio.desktop"
124+
DESKTOP_NAME="BambuStudio"
125+
DESKTOP_COMMENT="A cutting-edge, feature-rich slicing software."
126+
if [[ "$CHANNEL" == "beta" ]]; then
127+
SOURCE_PACKAGE_NAME="bambustudio-beta"
128+
BINARY_PACKAGE_NAME="bambustudio-beta"
129+
INSTALL_DIR="/opt/bambustudio-beta"
130+
WRAPPER_CMD="bambustudio-beta"
131+
DESKTOP_FILE="bambustudio-beta.desktop"
132+
DESKTOP_NAME="BambuStudio Beta"
133+
DESKTOP_COMMENT="Bambu Studio beta channel repackaged from the official Linux AppImage."
134+
fi
135+
119136
prepare_source_tree() {
120137
local series="$1"
121-
local asset_url asset_name workspace source_dir package_version ubuntu_series_version series_upstream_version launcher_path desktop_path icon_root orig_tarball orig_url debuild_source_args selected_include_mode
138+
local asset_url asset_name workspace source_dir package_version ubuntu_series_version series_upstream_version
139+
local launcher_path desktop_path icon_root orig_tarball orig_url debuild_source_args selected_include_mode
140+
local source_base_url
122141

123142
ubuntu_series_version="$(series_version_suffix "$series")"
124143
series_upstream_version="${VERSION}+${series}"
125144
package_version="${series_upstream_version}-0ppa${PPA_REVISION}~${ubuntu_series_version}.1"
126145
workspace="$BUILD_ROOT/$series"
127-
source_dir="$workspace/bambustudio-${series_upstream_version}"
146+
source_dir="$workspace/${SOURCE_PACKAGE_NAME}-${series_upstream_version}"
128147
mkdir -p "$workspace"
129148

130149
selected_include_mode="$SOURCE_INCLUDE_MODE"
@@ -151,10 +170,15 @@ prepare_source_tree() {
151170
;;
152171
esac
153172

154-
orig_tarball="$workspace/bambustudio_${series_upstream_version}.orig.tar.xz"
173+
source_base_url="$PPA_ORIG_BASE_URL"
174+
if [[ -z "$source_base_url" ]]; then
175+
source_base_url="https://ppa.launchpadcontent.net/daddyparodz/bambustudio/ubuntu/pool/main/${SOURCE_PACKAGE_NAME:0:1}/${SOURCE_PACKAGE_NAME}"
176+
fi
177+
178+
orig_tarball="$workspace/${SOURCE_PACKAGE_NAME}_${series_upstream_version}.orig.tar.xz"
155179
rm -f "$orig_tarball"
156180
if [[ "$selected_include_mode" == "exclude-orig" && "$REUSE_EXISTING_ORIG" == "1" ]]; then
157-
orig_url="${PPA_ORIG_BASE_URL}/bambustudio_${series_upstream_version}.orig.tar.xz"
181+
orig_url="${source_base_url}/${SOURCE_PACKAGE_NAME}_${series_upstream_version}.orig.tar.xz"
158182
if curl -fsSL "$orig_url" -o "$orig_tarball"; then
159183
echo "Reusing existing orig tarball from PPA: $orig_url"
160184
tar -C "$workspace" -xJf "$orig_tarball"
@@ -174,7 +198,14 @@ prepare_source_tree() {
174198
local appimage_size appimage_sha256
175199
appimage_size="$(stat -c '%s' "$source_dir/BambuStudio.AppImage")"
176200
appimage_sha256="$(sha256sum "$source_dir/BambuStudio.AppImage" | awk '{print $1}')"
201+
echo "Channel: ${CHANNEL}"
202+
echo "Source package: ${SOURCE_PACKAGE_NAME}"
203+
echo "Binary package: ${BINARY_PACKAGE_NAME}"
177204
echo "Series: ${series}"
205+
echo "Install path: ${INSTALL_DIR}/BambuStudio.AppImage"
206+
echo "Wrapper path: /usr/bin/${WRAPPER_CMD}"
207+
echo "Desktop file path: /usr/share/applications/${DESKTOP_FILE}"
208+
echo "Upstream tag: ${TAG}"
178209
echo "Asset URL: ${asset_url}"
179210
echo "Asset size (bytes): ${appimage_size}"
180211
echo "Asset sha256: ${appimage_sha256}"
@@ -188,6 +219,34 @@ prepare_source_tree() {
188219
)
189220

190221
cp -a "$REPO_ROOT/packaging/debian" "$source_dir/debian"
222+
sed -i \
223+
-e "s/@SOURCE_PACKAGE_NAME@/${SOURCE_PACKAGE_NAME}/g" \
224+
-e "s/@BINARY_PACKAGE_NAME@/${BINARY_PACKAGE_NAME}/g" \
225+
"$source_dir/debian/control"
226+
if [[ -f "$source_dir/debian/source/lintian-overrides" ]]; then
227+
sed -i "s/^bambustudio source:/${SOURCE_PACKAGE_NAME} source:/g" "$source_dir/debian/source/lintian-overrides"
228+
fi
229+
230+
rm -f "$source_dir/debian/bambustudio.install"
231+
cat > "$source_dir/debian/${BINARY_PACKAGE_NAME}.install" <<EOF
232+
BambuStudio.AppImage ${INSTALL_DIR}/
233+
${WRAPPER_CMD} usr/bin/
234+
${DESKTOP_FILE} usr/share/applications/
235+
BambuStudio.png usr/share/pixmaps/
236+
icons/32x32/apps/BambuStudio.png usr/share/icons/hicolor/32x32/apps/
237+
icons/128x128/apps/BambuStudio.png usr/share/icons/hicolor/128x128/apps/
238+
icons/192x192/apps/BambuStudio.png usr/share/icons/hicolor/192x192/apps/
239+
EOF
240+
241+
cat > "$source_dir/debian/tests/smoke" <<EOF
242+
#!/bin/sh
243+
set -eu
244+
245+
test -x ${INSTALL_DIR}/BambuStudio.AppImage
246+
test -x /usr/bin/${WRAPPER_CMD}
247+
test -f /usr/share/applications/${DESKTOP_FILE}
248+
EOF
249+
chmod 0755 "$source_dir/debian/tests/smoke"
191250

192251
if [[ -f "$source_dir/squashfs-root/BambuStudio.png" ]]; then
193252
cp "$source_dir/squashfs-root/BambuStudio.png" "$source_dir/BambuStudio.png"
@@ -209,32 +268,36 @@ prepare_source_tree() {
209268
fi
210269
done
211270

212-
launcher_path="$source_dir/bambustudio"
213-
cat > "$launcher_path" <<'EOF'
271+
launcher_path="$source_dir/${WRAPPER_CMD}"
272+
cat > "$launcher_path" <<'EOF'
214273
#!/usr/bin/env bash
215274
set -euo pipefail
216275
217-
APPIMAGE=/opt/bambustudio/BambuStudio.AppImage
276+
APPIMAGE=@INSTALL_DIR@/BambuStudio.AppImage
218277
export SSL_CERT_FILE="${SSL_CERT_FILE:-/etc/ssl/certs/ca-certificates.crt}"
219278
export SSL_CERT_DIR="${SSL_CERT_DIR:-/etc/ssl/certs}"
220279
221280
if command -v xdg-mime >/dev/null 2>&1; then
222-
if [[ "$(xdg-mime query default x-scheme-handler/bambustudioopen 2>/dev/null || true)" != "bambustudio.desktop" ]]; then
223-
xdg-mime default bambustudio.desktop x-scheme-handler/bambustudioopen x-scheme-handler/bambustudio >/dev/null 2>&1 || true
281+
if [[ "$(xdg-mime query default x-scheme-handler/bambustudioopen 2>/dev/null || true)" != "@DESKTOP_FILE@" ]]; then
282+
xdg-mime default @DESKTOP_FILE@ x-scheme-handler/bambustudioopen x-scheme-handler/bambustudio >/dev/null 2>&1 || true
224283
fi
225284
fi
226285
227286
exec "$APPIMAGE" "$@"
228287
EOF
229-
chmod 0755 "$launcher_path"
230-
231-
desktop_path="$source_dir/bambustudio.desktop"
232-
cat > "$desktop_path" <<EOF
288+
sed -i \
289+
-e "s|@INSTALL_DIR@|${INSTALL_DIR}|g" \
290+
-e "s|@DESKTOP_FILE@|${DESKTOP_FILE}|g" \
291+
"$launcher_path"
292+
chmod 0755 "$launcher_path"
293+
294+
desktop_path="$source_dir/${DESKTOP_FILE}"
295+
cat > "$desktop_path" <<EOF
233296
[Desktop Entry]
234-
Name=BambuStudio
297+
Name=${DESKTOP_NAME}
235298
GenericName=3D Printing Software
236-
Comment=A cutting-edge, feature-rich slicing software.
237-
Exec=/usr/bin/bambustudio %U
299+
Comment=${DESKTOP_COMMENT}
300+
Exec=/usr/bin/${WRAPPER_CMD} %U
238301
Icon=BambuStudio
239302
Terminal=false
240303
Type=Application
@@ -247,7 +310,7 @@ X-AppImage-Version=${VERSION}
247310
EOF
248311

249312
cat > "$source_dir/debian/changelog" <<EOF
250-
bambustudio (${package_version}) ${series}; urgency=medium
313+
${SOURCE_PACKAGE_NAME} (${package_version}) ${series}; urgency=medium
251314
252315
* Repackage upstream release ${TAG}.
253316
* Bundle the official ${asset_name} AppImage for Ubuntu ${series}.
@@ -257,12 +320,38 @@ EOF
257320

258321
rm -rf "$source_dir/squashfs-root"
259322
rm -f "$orig_tarball"
260-
tar --exclude='./debian' -C "$workspace" -cJf "$orig_tarball" "bambustudio-${series_upstream_version}"
323+
tar --exclude='./debian' -C "$workspace" -cJf "$orig_tarball" "${SOURCE_PACKAGE_NAME}-${series_upstream_version}"
261324
else
262325
rm -rf "$source_dir/debian"
263326
cp -a "$REPO_ROOT/packaging/debian" "$source_dir/debian"
327+
sed -i \
328+
-e "s/@SOURCE_PACKAGE_NAME@/${SOURCE_PACKAGE_NAME}/g" \
329+
-e "s/@BINARY_PACKAGE_NAME@/${BINARY_PACKAGE_NAME}/g" \
330+
"$source_dir/debian/control"
331+
if [[ -f "$source_dir/debian/source/lintian-overrides" ]]; then
332+
sed -i "s/^bambustudio source:/${SOURCE_PACKAGE_NAME} source:/g" "$source_dir/debian/source/lintian-overrides"
333+
fi
334+
rm -f "$source_dir/debian/bambustudio.install"
335+
cat > "$source_dir/debian/${BINARY_PACKAGE_NAME}.install" <<EOF
336+
BambuStudio.AppImage ${INSTALL_DIR}/
337+
${WRAPPER_CMD} usr/bin/
338+
${DESKTOP_FILE} usr/share/applications/
339+
BambuStudio.png usr/share/pixmaps/
340+
icons/32x32/apps/BambuStudio.png usr/share/icons/hicolor/32x32/apps/
341+
icons/128x128/apps/BambuStudio.png usr/share/icons/hicolor/128x128/apps/
342+
icons/192x192/apps/BambuStudio.png usr/share/icons/hicolor/192x192/apps/
343+
EOF
344+
cat > "$source_dir/debian/tests/smoke" <<EOF
345+
#!/bin/sh
346+
set -eu
347+
348+
test -x ${INSTALL_DIR}/BambuStudio.AppImage
349+
test -x /usr/bin/${WRAPPER_CMD}
350+
test -f /usr/share/applications/${DESKTOP_FILE}
351+
EOF
352+
chmod 0755 "$source_dir/debian/tests/smoke"
264353
cat > "$source_dir/debian/changelog" <<EOF
265-
bambustudio (${package_version}) ${series}; urgency=medium
354+
${SOURCE_PACKAGE_NAME} (${package_version}) ${series}; urgency=medium
266355
267356
* Rebuild Debian packaging revision for ${TAG}.
268357

scripts/validate-generated-packages.sh

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ for changes in "${changes_files[@]}"; do
3333
(
3434
cd "$stage"
3535
dpkg-source -x "$(basename "$dsc")"
36-
srcdir="$(find . -maxdepth 1 -type d -name 'bambustudio-*' | head -n1)"
36+
srcdir="$(find . -maxdepth 1 -type d \( -name 'bambustudio-*' -o -name 'bambustudio-beta-*' \) | head -n1)"
3737
appimg="$srcdir/BambuStudio.AppImage"
3838
appimg_size="$(stat -c '%s' "$appimg")"
3939
echo "Validating source AppImage for $pkg_base (size=$appimg_size)"
@@ -51,10 +51,21 @@ for changes in "${changes_files[@]}"; do
5151
dpkg-buildpackage -b -us -uc
5252
)
5353

54-
deb="$(find . -maxdepth 1 -type f -name 'bambustudio_*_amd64.deb' | head -n1)"
54+
deb="$(find . -maxdepth 1 -type f \( -name 'bambustudio_*_amd64.deb' -o -name 'bambustudio-beta_*_amd64.deb' \) | head -n1)"
5555
mkdir -p debroot
5656
dpkg-deb -x "$deb" debroot
57-
staged_appimg="debroot/opt/bambustudio/BambuStudio.AppImage"
57+
staged_appimg="$(find debroot/opt -maxdepth 3 -type f -name 'BambuStudio.AppImage' | head -n1)"
58+
if [[ -z "$staged_appimg" ]]; then
59+
echo "No staged AppImage found in built deb for $pkg_base" >&2
60+
exit 1
61+
fi
62+
if [[ "$staged_appimg" == *"/opt/bambustudio-beta/"* ]]; then
63+
staged_wrapper="debroot/usr/bin/bambustudio-beta"
64+
staged_desktop="debroot/usr/share/applications/bambustudio-beta.desktop"
65+
else
66+
staged_wrapper="debroot/usr/bin/bambustudio"
67+
staged_desktop="debroot/usr/share/applications/bambustudio.desktop"
68+
fi
5869
staged_size="$(stat -c '%s' "$staged_appimg")"
5970
echo "Validating built deb AppImage for $pkg_base (size=$staged_size)"
6071
if (( staged_size < 100000000 )); then
@@ -64,8 +75,8 @@ for changes in "${changes_files[@]}"; do
6475
chmod +x "$staged_appimg"
6576
"$staged_appimg" --appimage-extract >/dev/null
6677
test -f squashfs-root/AppRun
67-
test -x debroot/usr/bin/bambustudio
68-
test -f debroot/usr/share/applications/bambustudio.desktop
78+
test -x "$staged_wrapper"
79+
test -f "$staged_desktop"
6980
)
7081

7182
if [[ "$SOURCE_INCLUDE_MODE" == "exclude-orig" ]] || { [[ "$SOURCE_INCLUDE_MODE" == "auto" ]] && (( PPA_REVISION > 1 )); }; then

state/latest-beta-tag.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

0 commit comments

Comments
 (0)