Skip to content

Commit 8796942

Browse files
committed
ci: Add job for building debian packages
1 parent 94bdaa9 commit 8796942

File tree

4 files changed

+143
-24
lines changed

4 files changed

+143
-24
lines changed

.github/scripts/release.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ def bump():
134134
"""
135135

136136
current_version = cargo_get_version()
137+
current_day_id = get_current_day_id()
137138
log(f'Current version: {current_version}')
138139

139140
log('Bumping minor version to get the next planned version')
@@ -143,14 +144,13 @@ def bump():
143144

144145
log(f'Next planned version is {next_planned_version}')
145146

146-
current_time_version = get_current_time_version()
147-
nightly_version = f'{next_planned_version}-nightly.{current_time_version}'
147+
nightly_version = f'{next_planned_version}-nightly.{get_current_time_version()}'
148148
log(f'Nightly version is {nightly_version}')
149149

150150
cargo_set_version([nightly_version])
151151

152152
version = cargo_get_version()
153-
version4 = f'{next_planned_version}.{get_current_day_id()}'
153+
version4 = f'{next_planned_version}.{current_day_id}'
154154

155155
npm_dir = f'{REPO_DIR}/web'
156156
run_command(['npm', 'install', 'workspace-version'], cwd=npm_dir)
@@ -161,7 +161,7 @@ def bump():
161161
github_output('version', version)
162162
github_output('version4', version4)
163163

164-
deb_changelog(next_planned_version, ''.join(part.zfill(2) for part in current_time_version.split('.')), datetime.now())
164+
deb_changelog(version, current_day_id, datetime.now())
165165

166166

167167
def metainfo():

.github/workflows/release_nightly.yml

Lines changed: 130 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
upload_url: ${{ steps.create_release.outputs.upload_url }}
2222
package_prefix: ${{ steps.create_release.outputs.package_prefix }}
2323
tag_name: ${{ steps.commit.outputs.tag_name }}
24+
version: ${{ steps.version.outputs.version }}
2425
version4: ${{ steps.version.outputs.version4 }}
2526

2627
# Only run the scheduled workflows on the main repo.
@@ -54,16 +55,21 @@ jobs:
5455
crate: cargo-get
5556
version: '^1.0'
5657

58+
- name: Get last tag
59+
id: last_tag
60+
run: echo "last_tag=`gh release list --order=desc --limit=1 --json tagName --jq '.[0].tagName'`" >> $GITHUB_OUTPUT
61+
env:
62+
GITHUB_TOKEN: ${{ secrets.PGITHUB_TOKEN }}
5763
- name: Get changelog
5864
uses: mikepenz/[email protected]
5965
with:
60-
owner: "ruffle-rs"
61-
repo: "ruffle"
62-
fromTag: "nightly-2025-12-01"
63-
toTag: "nightly-2025-12-02"
66+
owner: ruffle-rs
67+
repo: ruffle
68+
#fromTag: nightly-2025-12-03
69+
fromTag: ${{ steps.last_tag.outputs.last_tag }}
70+
toTag: HEAD
6471
token: ${{ secrets.PGITHUB_TOKEN }}
65-
outputFile: ".github/changelog.entries"
66-
failOnError: "true"
72+
outputFile: .github/changelog.entries
6773
configurationJson: |
6874
{
6975
"template": "#{{UNCATEGORIZED}}",
@@ -663,3 +669,121 @@ jobs:
663669
commit_email: [email protected]
664670
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
665671
commit_message: Update to ${{ needs.create-nightly-release.outputs.tag_name }}
672+
673+
build-debian-packages:
674+
name: Build Debian ${{ matrix.build_name }} packages
675+
needs: [create-nightly-release, build]
676+
strategy:
677+
fail-fast: false
678+
matrix:
679+
include:
680+
- build_name: amd64
681+
os: ubuntu-24.04
682+
arch: x86_64
683+
- build_name: arm64
684+
os: ubuntu-24.04-arm
685+
arch: aarch64
686+
runs-on: ${{ matrix.os }}
687+
if: github.repository == 'donmor/ruffle'
688+
steps:
689+
- uses: actions/checkout@v6
690+
with:
691+
ref: ${{ needs.create-nightly-release.outputs.tag_name }}
692+
- name: Get current time with dashes
693+
uses: josStorer/[email protected]
694+
id: current_time_dashes
695+
with:
696+
format: YYYY-MM-DD
697+
698+
- name: Get current time with dots
699+
uses: josStorer/[email protected]
700+
id: current_time_dots
701+
with:
702+
format: YYYY.M.D
703+
704+
- name: Install build dependencies
705+
run: sudo apt install debhelper rename
706+
- name: Prepare informations and source
707+
id: profiling
708+
run: |
709+
version4=${{ needs.create-nightly-release.outputs.version4 }}
710+
version=${{ needs.create-nightly-release.outputs.version }}
711+
revision=${version4##*.}
712+
echo "version=${version}" >>$GITHUB_OUTPUT
713+
echo "revision=${revision}" >>$GITHUB_OUTPUT
714+
git archive --prefix=ruffle-${version}/ -o ../ruffle_${version}.orig.tar.gz HEAD
715+
cp -a desktop/packages/linux/debian ./
716+
- name: Build Source package
717+
if: runner.arch == 'X64'
718+
run: |
719+
dpkg-buildpackage -us -uc -d -S
720+
- name: Get prebuilt binaries
721+
run: |
722+
gh release download "${{ needs.create-nightly-release.outputs.tag_name }}" --pattern "${{ needs.create-nightly-release.outputs.package_prefix }}-linux-${{ matrix.arch }}.tar.gz"
723+
tar -xf "${{ needs.create-nightly-release.outputs.package_prefix }}-linux-${{ matrix.arch }}.tar.gz" ruffle
724+
rm "${{ needs.create-nightly-release.outputs.package_prefix }}-linux-${{ matrix.arch }}.tar.gz"
725+
mv ruffle ruffle_desktop
726+
env:
727+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
728+
- name: Build Packages
729+
run: |
730+
dpkg-buildpackage -us -uc -nc -d -b
731+
rename 's/\.deb/\.ddeb/' *-dbgsym*.deb
732+
- name: Move built files (sources)
733+
if: runner.arch == 'X64'
734+
run: |
735+
mv ../ruffle_${{ steps.profiling.outputs.version }}.orig.tar.gz ./
736+
mv ../ruffle_${{ steps.profiling.outputs.version }}-${{ steps.profiling.outputs.revision }}.debian.tar.xz ./
737+
mv ../ruffle_${{ steps.profiling.outputs.version }}-${{ steps.profiling.outputs.revision }}.dsc ./
738+
mv ../ruffle_${{ steps.profiling.outputs.version }}-${{ steps.profiling.outputs.revision }}_source.buildinfo ./
739+
mv ../ruffle_${{ steps.profiling.outputs.version }}-${{ steps.profiling.outputs.revision }}_source.changes ./
740+
- name: Move built files (packages)
741+
run: |
742+
mv ../ruffle_${{ steps.profiling.outputs.version }}-${{ steps.profiling.outputs.revision }}_${{ matrix.build_name }}.buildinfo ./
743+
mv ../ruffle_${{ steps.profiling.outputs.version }}-${{ steps.profiling.outputs.revision }}_${{ matrix.build_name }}.changes ./
744+
mv ../ruffle-desktop_${{ steps.profiling.outputs.version }}-${{ steps.profiling.outputs.revision }}_${{ matrix.build_name }}.deb ./
745+
mv ../ruffle-desktop-dbgsym_${{ steps.profiling.outputs.version }}-${{ steps.profiling.outputs.revision }}_${{ matrix.build_name }}.ddeb ./
746+
- name: Upload Source package as build artifact
747+
if: runner.arch == 'X64'
748+
uses: actions/upload-artifact@v5
749+
with:
750+
name: deb-source
751+
path: |
752+
ruffle_${{ steps.profiling.outputs.version }}.orig.tar.gz
753+
ruffle_${{ steps.profiling.outputs.version }}-${{ steps.profiling.outputs.revision }}.debian.tar.xz
754+
ruffle_${{ steps.profiling.outputs.version }}-${{ steps.profiling.outputs.revision }}.dsc
755+
ruffle_${{ steps.profiling.outputs.version }}-${{ steps.profiling.outputs.revision }}_source.buildinfo
756+
ruffle_${{ steps.profiling.outputs.version }}-${{ steps.profiling.outputs.revision }}_source.changes
757+
- name: Upload Packages as build artifact
758+
uses: actions/upload-artifact@v5
759+
with:
760+
name: deb-${{ matrix.build_name }}
761+
path: |
762+
ruffle_${{ steps.profiling.outputs.version }}-${{ steps.profiling.outputs.revision }}_${{ matrix.build_name }}.buildinfo
763+
ruffle_${{ steps.profiling.outputs.version }}-${{ steps.profiling.outputs.revision }}_${{ matrix.build_name }}.changes
764+
ruffle-desktop_${{ steps.profiling.outputs.version }}-${{ steps.profiling.outputs.revision }}_${{ matrix.build_name }}.deb
765+
ruffle-desktop-dbgsym_${{ steps.profiling.outputs.version }}-${{ steps.profiling.outputs.revision }}_${{ matrix.build_name }}.ddeb
766+
publish-debian-packages:
767+
name: Publish Debian packages
768+
needs: [create-nightly-release, build-debian-packages]
769+
runs-on: ubuntu-24.04
770+
steps:
771+
- name: Download all artifacts previously built
772+
uses: actions/download-artifact@v4
773+
with:
774+
merge-multiple: true
775+
run-id: ${{ needs.build-debian-packages.outputs.run_id }}
776+
path: download/${{ needs.create-nightly-release.outputs.tag_name }}
777+
- name: Generate trivial source
778+
working-directory: download/${{ needs.create-nightly-release.outputs.tag_name }}
779+
run: |
780+
dpkg-scanpackages -m ../../download/${{ needs.create-nightly-release.outputs.tag_name }} > Packages
781+
dpkg-scanpackages -t ddeb -m ../../download/${{ needs.create-nightly-release.outputs.tag_name }} >> Packages
782+
dpkg-scansources ../../download/${{ needs.create-nightly-release.outputs.tag_name }} > Sources
783+
apt-ftparchive release . > Release
784+
- name: Upload packages
785+
run: |
786+
gh release upload -R ${{ github.repository }} "${{ needs.create-nightly-release.outputs.tag_name }}" `find download -name 'ruffle*.deb'` `find download -name 'ruffle*.ddeb'`
787+
gh release upload -R ${{ github.repository }} "${{ needs.create-nightly-release.outputs.tag_name }}" `find download -name 'ruffle*.orig.tar.gz'` `find download -name 'ruffle*.debian.tar.xz'` `find download -name 'ruffle*.dsc'` download/${{ needs.create-nightly-release.outputs.tag_name }}/Packages download/${{ needs.create-nightly-release.outputs.tag_name }}/Sources download/${{ needs.create-nightly-release.outputs.tag_name }}/Release
788+
env:
789+
GITHUB_TOKEN: ${{ secrets.PGITHUB_TOKEN }}

Makefile

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ prefix ?= /usr/local
1616
VERSION := $(shell cargo metadata --format-version=1 --no-deps --offline | jq -r '.packages[] | select(.name == "ruffle_desktop").version')
1717
DEBIAN_ORIG_GZ := ../ruffle_$(VERSION).orig.tar.gz
1818
DEBIAN_ORIG_XZ := ../ruffle_$(VERSION).orig.tar.xz
19-
REVISION := $(shell echo $(notdir $(CURDIR)) | sed 's/$(VERSION)//' | tr -cd '0-9')
19+
REVISION := $(shell date -d $(shell echo $(notdir $(CURDIR)) | sed 's/ruffle-//' | sed 's/nightly-//' | sed 's/$(VERSION)-//') +%y%j)
2020
ifeq ($(REVISION),)
21-
REVISION := $(shell date +%Y%m%d)
21+
REVISION := $(shell date +%y%j)
2222
endif
2323

2424
all: ruffle_desktop
@@ -63,7 +63,7 @@ version:
6363
fi; \
6464
sed $(SI) '1i\ -- $(DEBFULLNAME) <$(DEBEMAIL)> $(DEBDATE)' $(DEBIAN_DIR)/changelog; \
6565
sed $(SI) '1i\\' $(DEBIAN_DIR)/changelog; \
66-
touch -a .github/changelog.entries \
66+
touch -a .github/changelog.entries; \
6767
tac .github/changelog.entries | while read line; do \
6868
sed $(SI) "1i$$line" $(DEBIAN_DIR)/changelog; \
6969
done; \
@@ -73,8 +73,12 @@ version:
7373

7474
deb: version
7575
@if [ ! -s $(DEBIAN_ORIG_XZ) -a ! -s $(DEBIAN_ORIG_GZ) ]; then \
76-
echo 'Creating $(DEBIAN_ORIG_GZ) from HEAD...' >&2; \
77-
git archive --prefix=ruffle-$(VERSION)/ -o $(DEBIAN_ORIG_GZ) HEAD; \
76+
if [ -s ../$(notdir $(CURDIR)).tar.gz ]; then \
77+
mv -v ../$(notdir $(CURDIR)).tar.gz $(DEBIAN_ORIG_GZ); \
78+
else \
79+
echo 'Creating $(DEBIAN_ORIG_GZ) from HEAD...' >&2; \
80+
git archive --prefix=ruffle-$(VERSION)/ -o $(DEBIAN_ORIG_GZ) HEAD; \
81+
fi; \
7882
fi
7983
rm -rf debian
8084
cp -a $(DEBIAN_DIR) ./
Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +0,0 @@
1-
ruffle (0.1.0-20251202) unstable; urgency=medium
2-
3-
* chore: test entry text
4-
* chore: test entry text 2
5-
6-
-- unknown <unknown@localhost> Tue, 02 Dec 2025 20:57:04 +0800
7-
8-
9-

0 commit comments

Comments
 (0)