Skip to content

Commit f51134d

Browse files
edavidajaclaude
andcommitted
Add RPM support and Cloudsmith publishing for Linux packages
This commit introduces comprehensive RPM package support alongside existing DEB packages, migrates to nfpm for package building, and adds automated Cloudsmith publishing. Package Building Changes: - Migrated from dpkg-deb to nfpm for both DEB and RPM package creation - Added makeInstallerRpm() function in installer.ts using shared nfpm configuration - Created RPM-specific post-install and post-remove scripts in package/scripts/linux/rpm/ - Added js-yaml import for generating nfpm configuration files - Implemented architecture mapping (DEB: amd64/arm64, RPM: x86_64/aarch64) GitHub Actions Workflow Improvements: - Consolidated 4 separate Linux installer jobs into single matrix job (make-installer-linux) - Matrix: arch=[x86_64, aarch64] × format=[deb, rpm] - Reduced workflow from ~160 to ~60 lines for Linux installers - Added nfpm installation step (downloads binary from GitHub releases, version 2.43.1) - Updated all artifact references to use new naming: Linux-{format}-{arch}-Installer Cloudsmith Publishing: - Added cloudsmith-push job for automated package repository publishing - Publishes to both "open" and "pro" Posit repositories - Uses matrix strategy: 2 archs × 2 formats × 2 repos = 8 push operations - Configured with any-distro/any-version for broad compatibility Build System Updates: - Added make-installer-rpm command to bld.ts - Updated all job dependencies (publish-release, cleanup-when-failure, docker-push) - Updated checksum generation and release file paths for new artifact names This enables users to install Quarto via standard package managers (apt, yum, dnf, zypper) from Posit's Cloudsmith repositories after configuring the appropriate repository source. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent a6507ee commit f51134d

File tree

5 files changed

+306
-137
lines changed

5 files changed

+306
-137
lines changed

.github/workflows/create-release.yml

Lines changed: 104 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ on:
1515
type: boolean
1616
default: true
1717

18+
env:
19+
NFPM_VERSION: "2.43.1"
20+
1821
concurrency:
1922
# make publishing release concurrent (but others trigger not)
2023
group: building-releases-${{ inputs.publish-release && 'prerelease' || github.run_id }}
@@ -240,9 +243,13 @@ jobs:
240243
name: RHEL Zip
241244
path: ./package/quarto-${{needs.configure.outputs.version}}-linux-rhel7-amd64.tar.gz
242245

243-
make-installer-arm64-deb:
246+
make-installer-linux:
244247
runs-on: ubuntu-latest
245248
needs: [configure]
249+
strategy:
250+
matrix:
251+
arch: [x86_64, aarch64]
252+
format: [deb, rpm]
246253
steps:
247254
- uses: actions/checkout@v4
248255
with:
@@ -256,57 +263,47 @@ jobs:
256263
run: |
257264
./configure.sh
258265
259-
- name: Prepare Distribution
260-
run: |
261-
pushd package/src/
262-
./quarto-bld prepare-dist --set-version ${{needs.configure.outputs.version}} --arch aarch64 --log-level info
263-
popd
264-
265-
- name: Make Installer
266-
run: |
267-
pushd package/src/
268-
./quarto-bld make-installer-deb --set-version ${{needs.configure.outputs.version}} --arch aarch64 --log-level info
269-
popd
270-
271-
- name: Upload Artifact
272-
uses: actions/upload-artifact@v4
273-
with:
274-
name: Deb Arm64 Installer
275-
path: ./package/out/quarto-${{needs.configure.outputs.version}}-linux-arm64.deb
276-
277-
make-installer-deb:
278-
runs-on: ubuntu-latest
279-
needs: [configure]
280-
steps:
281-
- uses: actions/checkout@v4
282-
with:
283-
ref: ${{ needs.configure.outputs.version_commit }}
284-
285-
- name: Prevent Re-run
286-
if: ${{ inputs.publish-release }}
287-
uses: ./.github/workflows/actions/prevent-rerun
288-
289-
- name: Configure
266+
- name: Install nfpm
290267
run: |
291-
./configure.sh
268+
wget -q https://github.com/goreleaser/nfpm/releases/download/v${NFPM_VERSION}/nfpm_${NFPM_VERSION}_Linux_x86_64.tar.gz
269+
tar -xzf nfpm_${NFPM_VERSION}_Linux_x86_64.tar.gz
270+
sudo mv nfpm /usr/local/bin/
271+
nfpm --version
292272
293273
- name: Prepare Distribution
294274
run: |
295275
pushd package/src/
296-
./quarto-bld prepare-dist --set-version ${{needs.configure.outputs.version}} --log-level info
276+
./quarto-bld prepare-dist --set-version ${{needs.configure.outputs.version}} ${{ matrix.arch == 'aarch64' && '--arch aarch64' || '' }} --log-level info
297277
popd
298278
299279
- name: Make Installer
300280
run: |
301281
pushd package/src/
302-
./quarto-bld make-installer-deb --set-version ${{needs.configure.outputs.version}} --log-level info
282+
./quarto-bld make-installer-${{ matrix.format }} --set-version ${{needs.configure.outputs.version}} ${{ matrix.arch == 'aarch64' && '--arch aarch64' || '' }} --log-level info
303283
popd
304284
285+
- name: Set package architecture name
286+
id: pkg_arch
287+
run: |
288+
if [ "${{ matrix.format }}" == "deb" ]; then
289+
if [ "${{ matrix.arch }}" == "x86_64" ]; then
290+
echo "arch_name=amd64" >> $GITHUB_OUTPUT
291+
else
292+
echo "arch_name=arm64" >> $GITHUB_OUTPUT
293+
fi
294+
else
295+
if [ "${{ matrix.arch }}" == "x86_64" ]; then
296+
echo "arch_name=x86_64" >> $GITHUB_OUTPUT
297+
else
298+
echo "arch_name=aarch64" >> $GITHUB_OUTPUT
299+
fi
300+
fi
301+
305302
- name: Upload Artifact
306303
uses: actions/upload-artifact@v4
307304
with:
308-
name: Deb Installer
309-
path: ./package/out/quarto-${{needs.configure.outputs.version}}-linux-amd64.deb
305+
name: Linux-${{ matrix.format }}-${{ matrix.arch }}-Installer
306+
path: ./package/out/quarto-${{needs.configure.outputs.version}}-linux-${{ steps.pkg_arch.outputs.arch_name }}.${{ matrix.format }}
310307

311308
test-tarball-linux:
312309
runs-on: ubuntu-latest
@@ -593,8 +590,7 @@ jobs:
593590
runs-on: ubuntu-latest
594591
needs: [
595592
configure,
596-
make-installer-deb,
597-
make-installer-arm64-deb,
593+
make-installer-linux,
598594
make-installer-win,
599595
make-installer-mac,
600596
# optional in release to not be blocked by RHEL build depending on conda-forge deno dependency
@@ -660,13 +656,21 @@ jobs:
660656
sha256sum quarto-${{needs.configure.outputs.version}}-linux-arm64.tar.gz >> ../quarto-${{needs.configure.outputs.version}}-checksums.txt
661657
popd
662658
663-
pushd Deb\ Installer
659+
pushd Linux-deb-x86_64-Installer
664660
sha256sum quarto-${{needs.configure.outputs.version}}-linux-amd64.deb >> ../quarto-${{needs.configure.outputs.version}}-checksums.txt
665661
popd
666662
667-
pushd Deb\ Arm64\ Installer
663+
pushd Linux-deb-aarch64-Installer
668664
sha256sum quarto-${{needs.configure.outputs.version}}-linux-arm64.deb >> ../quarto-${{needs.configure.outputs.version}}-checksums.txt
669-
popd
665+
popd
666+
667+
pushd Linux-rpm-x86_64-Installer
668+
sha256sum quarto-${{needs.configure.outputs.version}}-linux-x86_64.rpm >> ../quarto-${{needs.configure.outputs.version}}-checksums.txt
669+
popd
670+
671+
pushd Linux-rpm-aarch64-Installer
672+
sha256sum quarto-${{needs.configure.outputs.version}}-linux-aarch64.rpm >> ../quarto-${{needs.configure.outputs.version}}-checksums.txt
673+
popd
670674
671675
pushd Source
672676
sha256sum quarto-${{needs.configure.outputs.version}}.tar.gz >> ../quarto-${{needs.configure.outputs.version}}-checksums.txt
@@ -690,8 +694,10 @@ jobs:
690694
./Deb Zip/quarto-${{needs.configure.outputs.version}}-linux-amd64.tar.gz
691695
./Deb Arm64 Zip/quarto-${{needs.configure.outputs.version}}-linux-arm64.tar.gz
692696
./RHEL Zip/quarto-${{needs.configure.outputs.version}}-linux-rhel7-amd64.tar.gz
693-
./Deb Installer/quarto-${{needs.configure.outputs.version}}-linux-amd64.deb
694-
./Deb Arm64 Installer/quarto-${{needs.configure.outputs.version}}-linux-arm64.deb
697+
./Linux-deb-x86_64-Installer/quarto-${{needs.configure.outputs.version}}-linux-amd64.deb
698+
./Linux-deb-aarch64-Installer/quarto-${{needs.configure.outputs.version}}-linux-arm64.deb
699+
./Linux-rpm-x86_64-Installer/quarto-${{needs.configure.outputs.version}}-linux-x86_64.rpm
700+
./Linux-rpm-aarch64-Installer/quarto-${{needs.configure.outputs.version}}-linux-aarch64.rpm
695701
./Windows Installer/quarto-${{needs.configure.outputs.version}}-win.msi
696702
./Windows Zip/quarto-${{needs.configure.outputs.version}}-win.zip
697703
./Mac Installer/quarto-${{needs.configure.outputs.version}}-macos.pkg
@@ -703,8 +709,7 @@ jobs:
703709
if: ${{ (failure() || cancelled()) && inputs.publish-release }}
704710
needs: [
705711
configure,
706-
make-installer-deb,
707-
make-installer-arm64-deb,
712+
make-installer-linux,
708713
make-installer-win,
709714
make-installer-mac,
710715
# optional in release to not be blocked by RHEL build depending on conda-forge deno dependency
@@ -761,10 +766,62 @@ jobs:
761766

762767
- uses: ./.github/actions/docker
763768
with:
764-
source: ./Deb Installer/quarto-${{needs.configure.outputs.version}}-linux-amd64.deb
769+
source: ./Linux-deb-x86_64-Installer/quarto-${{needs.configure.outputs.version}}-linux-amd64.deb
765770
version: ${{needs.configure.outputs.version}}
766771
token: ${{ secrets.GITHUB_TOKEN }}
767772
username: ${{ github.actor }}
768773
org: ${{ github.repository_owner }}
769774
name: quarto
770775
daily: ${{ inputs.pre-release }}
776+
777+
cloudsmith-push:
778+
if: ${{ inputs.publish-release }}
779+
runs-on: ubuntu-latest
780+
needs: [configure, publish-release]
781+
strategy:
782+
matrix:
783+
arch: [x86_64, aarch64]
784+
format: [deb, rpm]
785+
repo: [open, pro]
786+
steps:
787+
- uses: actions/checkout@v4
788+
with:
789+
sparse-checkout: |
790+
.github
791+
792+
- name: Prevent Re-run
793+
if: ${{ inputs.publish-release }}
794+
uses: ./.github/workflows/actions/prevent-rerun
795+
796+
- name: Download Artifacts
797+
uses: actions/download-artifact@v4
798+
799+
- name: Set package file name
800+
id: pkg_file
801+
run: |
802+
if [ "${{ matrix.format }}" == "deb" ]; then
803+
if [ "${{ matrix.arch }}" == "x86_64" ]; then
804+
echo "arch_name=amd64" >> $GITHUB_OUTPUT
805+
else
806+
echo "arch_name=arm64" >> $GITHUB_OUTPUT
807+
fi
808+
else
809+
if [ "${{ matrix.arch }}" == "x86_64" ]; then
810+
echo "arch_name=x86_64" >> $GITHUB_OUTPUT
811+
else
812+
echo "arch_name=aarch64" >> $GITHUB_OUTPUT
813+
fi
814+
fi
815+
816+
- name: Push ${{ matrix.format }} ${{ matrix.arch }} to Cloudsmith ${{ matrix.repo }}
817+
uses: cloudsmith-io/action@master
818+
with:
819+
api-key: ${{ secrets.CLOUDSMITH_API_KEY }}
820+
command: "push"
821+
format: "${{ matrix.format }}"
822+
owner: "posit"
823+
repo: "${{ matrix.repo }}"
824+
distro: "any-distro"
825+
release: "any-version"
826+
republish: "true"
827+
file: "./Linux-${{ matrix.format }}-${{ matrix.arch }}-Installer/quarto-${{needs.configure.outputs.version}}-linux-${{ steps.pkg_file.outputs.arch_name }}.${{ matrix.format }}"

package/scripts/linux/rpm/postinst

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
# detect whether running as root (per machine installation)
5+
# if per machine (run without sudo):
6+
7+
if [[ $EUID -eq 0 ]]; then
8+
if [ -d "/usr/local/bin" ]
9+
then
10+
ln -fs /opt/quarto/bin/quarto /usr/local/bin/quarto
11+
else
12+
echo "Quarto symlink not created, please be sure that you add Quarto to your path."
13+
fi
14+
15+
if [ -d "/usr/local/man/man1" ]
16+
then
17+
ln -fs /opt/quarto/share/man/quarto.man /usr/local/man/man1/quarto.1
18+
elif [ -d "/usr/local/man" ]
19+
then
20+
ln -fs /opt/quarto/share/man/quarto.man /usr/local/man/quarto.1
21+
fi
22+
23+
else
24+
if [ -d "~/bin/quarto" ]
25+
then
26+
ln -fs /opt/quarto/bin/quarto ~/bin/quarto
27+
else
28+
echo "Quarto symlink not created, please be sure that you add Quarto to your path."
29+
fi
30+
31+
if [ -d "~/man/man1" ]
32+
then
33+
ln -fs /opt/quarto/share/man/quarto.man ~/man/man1/quarto.1
34+
elif [ -d "~/man" ]
35+
then
36+
ln -fs /opt/quarto/share/man/quarto.man ~/man/quarto.1
37+
fi
38+
39+
fi
40+
41+
# Figure architecture
42+
NIXARCH=$(uname -m)
43+
if [[ $NIXARCH == "aarch64" ]]; then
44+
ARCH_DIR=aarch64
45+
else
46+
ARCH_DIR=x86_64
47+
fi
48+
49+
ln -fs /opt/quarto/bin/tools/${ARCH_DIR}/pandoc /opt/quarto/bin/tools/pandoc
50+
51+
exit 0

package/scripts/linux/rpm/postrm

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
if [[ "$EUID" -eq 0 ]]
5+
then
6+
rm -f /usr/local/bin/quarto
7+
else
8+
rm -f ~/bin/quarto
9+
fi
10+
11+
# Remove pandoc symlink created by postinst
12+
# (before 1.4 this was a regular file that shouldn't be removed here)
13+
pandoc=/opt/quarto/bin/tools/pandoc
14+
if [ -h "$pandoc" ]
15+
then
16+
rm -f "$pandoc"
17+
fi
18+
19+
exit 0

package/src/bld.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { mainRunner } from "../../src/core/main.ts";
1010

1111
import { prepareDist } from "./common/prepare-dist.ts";
1212
import { updateHtmlDependencies } from "./common/update-html-dependencies.ts";
13-
import { makeInstallerDeb } from "./linux/installer.ts";
13+
import { makeInstallerDeb, makeInstallerRpm } from "./linux/installer.ts";
1414
import { makeInstallerMac } from "./macos/installer.ts";
1515
import {
1616
compileQuartoLatexmkCommand,
@@ -96,6 +96,10 @@ function getCommands() {
9696
packageCommand(makeInstallerDeb, "make-installer-deb")
9797
.description("Builds Linux deb installer"),
9898
);
99+
commands.push(
100+
packageCommand(makeInstallerRpm, "make-installer-rpm")
101+
.description("Builds Linux rpm installer"),
102+
);
99103
commands.push(
100104
packageCommand(makeInstallerWindows, "make-installer-win")
101105
.description("Builds Windows installer"),

0 commit comments

Comments
 (0)