neiam
/markprompter
public · Issues · Pulls · Labels · Forks · Compare · Actions failure · Badges · Packages
⭐
Log in to mark this repository.
Build and publish a .deb and an .rpm to the forge
1f7b54f · Gabriel Morell · 2026-09-14 05:14
Message
{commit_body(@commit)}
Files changed
modified
.github/workflows/rust-ci.yml
+154
−2
@@ -34,7 +34,7 @@ jobs:
| 34 | 34 | run: | |
| 35 | 35 | if command -v apt-get &> /dev/null; then |
| 36 | 36 | sudo apt-get update |
| 37 | − sudo apt-get install -y build-essential pkg-config libssl-dev libgtk-3-dev libgdk-pixbuf2.0-dev libpango1.0-dev | |
| 37 | + sudo apt-get install -y build-essential pkg-config libssl-dev libgtk-3-dev libgdk-pixbuf2.0-dev libpango1.0-dev libglib2.0-dev | |
| 38 | 38 | elif command -v yum &> /dev/null; then |
| 39 | 39 | sudo yum install -y pkgconfig openssl-devel gtk3-devel gdk-pixbuf-devel pango-devel |
| 40 | 40 | elif command -v dnf &> /dev/null; then |
@@ -72,6 +72,148 @@ jobs:
| 72 | 72 | - name: Check |
| 73 | 73 | run: cargo check |
| 74 | 74 | |
| 75 | + - name: Build release artifact | |
| 76 | + run: cargo build --release --verbose | |
| 77 | + | |
| 78 | + - name: Strip binary | |
| 79 | + run: strip target/release/markprompter | |
| 80 | + | |
| 81 | + - name: Install cargo-deb | |
| 82 | + run: cargo install cargo-deb | |
| 83 | + | |
| 84 | + - name: Install cargo-generate-rpm | |
| 85 | + run: cargo install cargo-generate-rpm | |
| 86 | + | |
| 87 | + # Every CI build has to carry a distinct version, or the second | |
| 88 | + # one publishes the same filename with different bytes and the | |
| 89 | + # registry correctly refuses it with a 409 — and no machine that | |
| 90 | + # installed the first ever sees the second. | |
| 91 | + # | |
| 92 | + # `+` rather than `-`: RPM forbids `-` in a version outright, and | |
| 93 | + # in both ecosystems `0.2.0+dev.<stamp>` sorts *after* 0.2.0, | |
| 94 | + # which is what you want from a repository you added in order to | |
| 95 | + # run the latest build. A tag publishes the bare Cargo version. | |
| 96 | + # | |
| 97 | + # One stamp for the whole job, so the .deb and the .rpm from a | |
| 98 | + # single run agree about what they are. | |
| 99 | + - name: Stamp the package version | |
| 100 | + id: version | |
| 101 | + run: | | |
| 102 | + set -euo pipefail | |
| 103 | + base=$(grep -m1 '^version = ' Cargo.toml | cut -d'"' -f2) | |
| 104 | + | |
| 105 | + if [ "${GITHUB_REF_TYPE:-}" = "tag" ]; then | |
| 106 | + version="$base" | |
| 107 | + else | |
| 108 | + version="$base+dev.$(date -u +%s)" | |
| 109 | + fi | |
| 110 | + | |
| 111 | + echo "version: $version" | |
| 112 | + echo "version=$version" >> "$GITHUB_OUTPUT" | |
| 113 | + | |
| 114 | + # Rewritten after the release build, so the binary is cached | |
| 115 | + # on the unstamped manifest and only the packaging sees this. | |
| 116 | + sed -i "0,/^version = .*/s//version = \"$version\"/" Cargo.toml | |
| 117 | + | |
| 118 | + - name: Build the Debian package | |
| 119 | + run: cargo deb --no-build --no-strip | |
| 120 | + | |
| 121 | + - name: Build the RPM package | |
| 122 | + run: cargo generate-rpm | |
| 123 | + | |
| 124 | + # This repository has two remotes, and only one of them has a | |
| 125 | + # package registry. `vars.CI_FORGE_URL` is what the forge injects | |
| 126 | + # into a run; fall back to what the runner already knows. | |
| 127 | + # | |
| 128 | + # Not publishing is a legitimate outcome here, not an error: | |
| 129 | + # github.com has no registry at these paths, and a workflow that | |
| 130 | + # is permanently red on one remote teaches everyone to ignore it. | |
| 131 | + # So this decides, and the publish step reads the decision. | |
| 132 | + - name: Resolve the forge URL | |
| 133 | + env: | |
| 134 | + CI_FORGE_URL: ${{ vars.CI_FORGE_URL }} | |
| 135 | + run: | | |
| 136 | + set -euo pipefail | |
| 137 | + forge_url=${CI_FORGE_URL:-${GITHUB_SERVER_URL:-}} | |
| 138 | + | |
| 139 | + if [ -z "$forge_url" ]; then | |
| 140 | + echo "No forge URL available; not publishing." | |
| 141 | + echo "Set a CI_FORGE_URL variable on this repository to publish." | |
| 142 | + echo "PUBLISH=false" >> "$GITHUB_ENV" | |
| 143 | + exit 0 | |
| 144 | + fi | |
| 145 | + | |
| 146 | + case "$forge_url" in | |
| 147 | + *://github.com|*://github.com/*|*://www.github.com*) | |
| 148 | + echo "Running on GitHub, which has no package registry here." | |
| 149 | + echo "Set CI_FORGE_URL to publish from this remote as well." | |
| 150 | + echo "PUBLISH=false" >> "$GITHUB_ENV" | |
| 151 | + ;; | |
| 152 | + *) | |
| 153 | + echo "publishing to $forge_url" | |
| 154 | + echo "FORGE_URL=$forge_url" >> "$GITHUB_ENV" | |
| 155 | + echo "PUBLISH=true" >> "$GITHUB_ENV" | |
| 156 | + ;; | |
| 157 | + esac | |
| 158 | + | |
| 159 | + # `${{ github.token }}` is minted for this job and authorized to | |
| 160 | + # publish to THIS repository's packages and nowhere else, so | |
| 161 | + # there is no secret to create first. | |
| 162 | + # | |
| 163 | + # Pull requests don't publish: a PR build is a check, and a | |
| 164 | + # registry that carries every proposed change is not a registry | |
| 165 | + # anyone can install from. | |
| 166 | + - name: Publish the .deb and the .rpm to the forge | |
| 167 | + if: github.event_name != 'pull_request' && env.PUBLISH == 'true' | |
| 168 | + env: | |
| 169 | + REPOSITORY: ${{ github.repository }} | |
| 170 | + TOKEN: ${{ github.token }} | |
| 171 | + run: | | |
| 172 | + set -euo pipefail | |
| 173 | + | |
| 174 | + for deb in target/debian/*.deb; do | |
| 175 | + echo "publishing $deb" | |
| 176 | + curl --fail-with-body -sS \ | |
| 177 | + -u "gitgud-actions:$TOKEN" \ | |
| 178 | + -H "Content-Type: application/vnd.debian.binary-package" \ | |
| 179 | + --data-binary "@$deb" \ | |
| 180 | + "$FORGE_URL/pkg/deb/$REPOSITORY/upload?dist=stable&component=main" | |
| 181 | + echo | |
| 182 | + done | |
| 183 | + | |
| 184 | + for rpm in target/generate-rpm/*.rpm; do | |
| 185 | + echo "publishing $rpm" | |
| 186 | + curl --fail-with-body -sS \ | |
| 187 | + -u "gitgud-actions:$TOKEN" \ | |
| 188 | + -H "Content-Type: application/x-rpm" \ | |
| 189 | + --data-binary "@$rpm" \ | |
| 190 | + "$FORGE_URL/pkg/rpm/$REPOSITORY/upload" | |
| 191 | + echo | |
| 192 | + done | |
| 193 | + | |
| 194 | + - name: How to install it | |
| 195 | + if: github.event_name != 'pull_request' && env.PUBLISH == 'true' | |
| 196 | + env: | |
| 197 | + OWNER: ${{ github.repository_owner }} | |
| 198 | + run: | | |
| 199 | + cat <<EOF | |
| 200 | + # Debian / Ubuntu | |
| 201 | + curl -fsSL $FORGE_URL/pkg/_keys/deb/$OWNER | sudo tee /etc/apt/keyrings/$OWNER.asc >/dev/null | |
| 202 | + echo "deb [signed-by=/etc/apt/keyrings/$OWNER.asc] $FORGE_URL/pkg/deb/$OWNER/_all stable main" | sudo tee /etc/apt/sources.list.d/$OWNER.list | |
| 203 | + sudo apt update && sudo apt install markprompter | |
| 204 | + | |
| 205 | + # Fedora / RHEL / openSUSE — /etc/yum.repos.d/$OWNER.repo | |
| 206 | + [$OWNER] | |
| 207 | + name=$OWNER | |
| 208 | + baseurl=$FORGE_URL/pkg/rpm/$OWNER/_all | |
| 209 | + enabled=1 | |
| 210 | + repo_gpgcheck=1 | |
| 211 | + # cargo-generate-rpm produces unsigned packages; the forge | |
| 212 | + # signs the index, not what it was handed. | |
| 213 | + gpgcheck=0 | |
| 214 | + gpgkey=$FORGE_URL/pkg/_keys/rpm/$OWNER | |
| 215 | + EOF | |
| 216 | + | |
| 75 | 217 | |
| 76 | 218 | release: |
| 77 | 219 | name: Release |
@@ -117,7 +259,7 @@ jobs:
| 117 | 259 | run: | |
| 118 | 260 | if command -v apt-get &> /dev/null; then |
| 119 | 261 | sudo apt-get update |
| 120 | − sudo apt-get install -y build-essential pkg-config libssl-dev libgtk-3-dev libgdk-pixbuf2.0-dev libpango1.0-dev libglib2.0-dev | |
| 262 | + sudo apt-get install -y build-essential pkg-config libssl-dev libgtk-3-dev libgdk-pixbuf2.0-dev libpango1.0-dev libglib2.0-dev | |
| 121 | 263 | elif command -v yum &> /dev/null; then |
| 122 | 264 | sudo yum install -y pkgconfig openssl-devel gtk3-devel gdk-pixbuf-devel pango-devel |
| 123 | 265 | elif command -v dnf &> /dev/null; then |
@@ -165,6 +307,15 @@ jobs:
| 165 | 307 | |
| 166 | 308 | - name: Upload release archive |
| 167 | 309 | uses: actions/upload-artifact@v4 |
| 310 | + # This forge has no artifact storage, so upload-artifact fails | |
| 311 | + # against it. The packages are published to the registry | |
| 312 | + # instead, which is the thing anyone actually installs from — | |
| 313 | + # failing the whole build over a copy nobody fetches would hide | |
| 314 | + # real failures behind a known one. | |
| 315 | + # | |
| 316 | + # Drop `continue-on-error` if artifact support lands, so a | |
| 317 | + # genuine upload failure is visible again. | |
| 318 | + continue-on-error: true | |
| 168 | 319 | with: |
| 169 | 320 | name: ${{ matrix.name }} |
| 170 | 321 | path: ${{ matrix.name }} |
@@ -181,6 +332,7 @@ jobs:
| 181 | 332 | |
| 182 | 333 | - name: Download all artifacts |
| 183 | 334 | uses: actions/download-artifact@v4 |
| 335 | + continue-on-error: true | |
| 184 | 336 | with: |
| 185 | 337 | path: artifacts |
| 186 | 338 |
modified
Cargo.toml
+28
−0
@@ -2,6 +2,34 @@
| 2 | 2 | name = "markprompter" |
| 3 | 3 | version = "0.2.0" |
| 4 | 4 | edition = "2021" |
| 5 | +description = "A markdown teleprompter with automatic scrolling and live preview" | |
| 6 | +authors = ["Gabe <gabe@neiam.org>"] | |
| 7 | +license = "GPL-3.0-or-later" | |
| 8 | + | |
| 9 | +# Packaging. Both tools read the release binary out of target/release, | |
| 10 | +# so `cargo build --release` has to have run first — `cargo deb | |
| 11 | +# --no-build` and `cargo generate-rpm` only assemble. | |
| 12 | +# | |
| 13 | +# No .desktop entry or icon: there are none in the repo to install, so | |
| 14 | +# this ships the binary and the docs. Add both here if MarkPrompter | |
| 15 | +# should show up in an application menu. | |
| 16 | +[package.metadata.deb] | |
| 17 | +assets = [ | |
| 18 | + # target/release is special, and cargo-deb replaces it with the | |
| 19 | + # actual target directory. | |
| 20 | + ["target/release/markprompter", "usr/bin/", "755"], | |
| 21 | + { source = "LICENSE.md", dest = "/usr/share/doc/neiam-markprompter/LICENSE", doc = true, mode = "0644" }, | |
| 22 | + { source = "README.md", dest = "/usr/share/doc/neiam-markprompter/README.md", doc = true, mode = "0644" }, | |
| 23 | +] | |
| 24 | +section = "utility" | |
| 25 | +license-file = ["LICENSE.md", "4"] | |
| 26 | + | |
| 27 | +[package.metadata.generate-rpm] | |
| 28 | +assets = [ | |
| 29 | + { source = "target/release/markprompter", dest = "/usr/bin/markprompter", mode = "0755" }, | |
| 30 | + { source = "LICENSE.md", dest = "/usr/share/doc/neiam-markprompter/LICENSE", doc = true, mode = "0644" }, | |
| 31 | + { source = "README.md", dest = "/usr/share/doc/neiam-markprompter/README.md", doc = true, mode = "0644" }, | |
| 32 | +] | |
| 5 | 33 | |
| 6 | 34 | [dependencies] |
| 7 | 35 | egui = "0.32.0" |
Parents: 2db72b6