Skip to content

Commit d97ffd1

Browse files
authored
Package managers: Homebrew tap, AUR, Fedora COPR and winget (#82)
* Package managers: Homebrew tap, AUR, Fedora COPR and winget A Package managers workflow publishes each release after the Release build, one isolated job per channel that skips itself without its secret: the opengeos/homebrew-rustgis tap (cask rustgis and formula rustgis-cli), the rustgis-bin AUR package, the giswqs/rustgis COPR project and OpenGeos.RustGIS on winget. Every package repackages the release's own files, with checksums from SHA256SUMS; the render scripts live in packaging/<channel>/. It can be run by hand for a tag, which publishes v0.1.0. The installation page and README list the install commands. * Package managers: pin copr-cli, which runs with the COPR token
1 parent 76407c9 commit d97ffd1

10 files changed

Lines changed: 739 additions & 0 deletions

File tree

Lines changed: 220 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,220 @@
1+
# Publishes each release to the package managers once the Release workflow has attached its
2+
# files: a Homebrew tap, the AUR, Fedora COPR and winget. Every channel is its own job, skips
3+
# itself when its secret is missing and never fails the others. Pre-releases are not published.
4+
# Run it by hand with a tag to republish a release. See packaging/README.md.
5+
#
6+
# Repository secrets:
7+
# HOMEBREW_TAP_DEPLOY_KEY - private half of an SSH deploy key with write access to
8+
# opengeos/homebrew-rustgis
9+
# AUR_SSH_PRIVATE_KEY - private SSH key of the AUR account that maintains rustgis-bin
10+
# COPR_CONFIG - the copr-cli config block from https://copr.fedorainfracloud.org/api/
11+
# (the token expires after 180 days)
12+
# WINGET_TOKEN - classic token (public_repo) of the account owning the winget-pkgs fork
13+
name: Package managers
14+
15+
on:
16+
workflow_run:
17+
workflows: [Release]
18+
types: [completed]
19+
workflow_dispatch:
20+
inputs:
21+
tag:
22+
description: Release tag to publish (defaults to the latest release)
23+
required: false
24+
type: string
25+
26+
permissions:
27+
contents: read
28+
29+
concurrency:
30+
group: package-managers-${{ inputs.tag || github.event.workflow_run.head_branch || 'latest' }}
31+
cancel-in-progress: false
32+
33+
jobs:
34+
release:
35+
name: Resolve the release
36+
# A workflow_run fires for trial runs too; only a published release's build counts.
37+
if: >-
38+
github.repository == 'opengeos/RustGIS' &&
39+
(github.event_name != 'workflow_run' ||
40+
(github.event.workflow_run.event == 'release' &&
41+
github.event.workflow_run.conclusion == 'success'))
42+
runs-on: ubuntu-latest
43+
outputs:
44+
tag: ${{ steps.release.outputs.tag }}
45+
version: ${{ steps.release.outputs.version }}
46+
date: ${{ steps.release.outputs.date }}
47+
publish: ${{ steps.release.outputs.publish }}
48+
steps:
49+
- name: Resolve the release
50+
id: release
51+
env:
52+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
REQUESTED_TAG: ${{ inputs.tag }}
54+
WORKFLOW_TAG: ${{ github.event.workflow_run.head_branch }}
55+
run: |
56+
tag="${REQUESTED_TAG:-${WORKFLOW_TAG:-}}"
57+
if [ -z "$tag" ]; then
58+
tag="$(gh api "repos/$GITHUB_REPOSITORY/releases/latest" --jq .tag_name)"
59+
fi
60+
json="$(gh api "repos/$GITHUB_REPOSITORY/releases/tags/$tag")"
61+
version="${tag#v}"
62+
publish=true
63+
if [ "$(jq -r .prerelease <<< "$json")" = true ] || ! [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
64+
echo "::notice::$tag is a pre-release: not published to package managers."
65+
publish=false
66+
fi
67+
{
68+
echo "tag=$tag"
69+
echo "version=$version"
70+
echo "date=$(jq -r .published_at <<< "$json" | cut -dT -f1)"
71+
echo "publish=$publish"
72+
} >> "$GITHUB_OUTPUT"
73+
74+
homebrew:
75+
name: Homebrew tap
76+
needs: release
77+
if: needs.release.outputs.publish == 'true'
78+
runs-on: ubuntu-latest
79+
continue-on-error: true
80+
concurrency:
81+
group: homebrew-tap
82+
cancel-in-progress: false
83+
env:
84+
TAP_KEY: ${{ secrets.HOMEBREW_TAP_DEPLOY_KEY }}
85+
steps:
86+
- uses: actions/checkout@v7
87+
if: env.TAP_KEY != ''
88+
with:
89+
persist-credentials: false
90+
91+
- name: Update opengeos/homebrew-rustgis
92+
if: env.TAP_KEY != ''
93+
env:
94+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
95+
TAG: ${{ needs.release.outputs.tag }}
96+
VERSION: ${{ needs.release.outputs.version }}
97+
run: |
98+
gh release download "$TAG" --repo "$GITHUB_REPOSITORY" --pattern SHA256SUMS --dir "$RUNNER_TEMP"
99+
eval "$(ssh-agent -s)"
100+
ssh-add - <<< "$TAP_KEY"
101+
git clone --depth 1 git@github.com:opengeos/homebrew-rustgis.git "$RUNNER_TEMP/tap"
102+
packaging/homebrew/render.sh "$VERSION" "$RUNNER_TEMP/SHA256SUMS" "$RUNNER_TEMP/tap"
103+
cd "$RUNNER_TEMP/tap"
104+
git add Casks Formula
105+
if git diff --cached --quiet; then
106+
echo "The tap already has $VERSION."
107+
exit 0
108+
fi
109+
git -c user.name="github-actions[bot]" -c user.email="41898282+github-actions[bot]@users.noreply.github.com" \
110+
commit -m "rustgis $VERSION"
111+
git push origin HEAD
112+
113+
aur:
114+
name: AUR
115+
needs: release
116+
if: needs.release.outputs.publish == 'true'
117+
runs-on: ubuntu-latest
118+
continue-on-error: true
119+
concurrency:
120+
group: aur
121+
cancel-in-progress: false
122+
env:
123+
AUR_KEY: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
124+
steps:
125+
- uses: actions/checkout@v7
126+
if: env.AUR_KEY != ''
127+
with:
128+
persist-credentials: false
129+
130+
- name: Render the PKGBUILD
131+
if: env.AUR_KEY != ''
132+
env:
133+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
134+
TAG: ${{ needs.release.outputs.tag }}
135+
VERSION: ${{ needs.release.outputs.version }}
136+
run: |
137+
gh release download "$TAG" --repo "$GITHUB_REPOSITORY" --pattern SHA256SUMS --dir "$RUNNER_TEMP"
138+
mkdir -p aur
139+
packaging/aur/render.sh "$VERSION" "$RUNNER_TEMP/SHA256SUMS" > aur/PKGBUILD
140+
cat aur/PKGBUILD
141+
142+
- name: Push rustgis-bin to the AUR
143+
if: env.AUR_KEY != ''
144+
# Pinned to a commit: this step receives the AUR key.
145+
uses: KSXGitHub/github-actions-deploy-aur@084b0d9b15415bf9cdb65d44dad1efe37a354050 # v4.2.0
146+
with:
147+
pkgname: rustgis-bin
148+
pkgbuild: aur/PKGBUILD
149+
commit_username: Qiusheng Wu
150+
commit_email: giswqs@gmail.com
151+
ssh_private_key: ${{ env.AUR_KEY }}
152+
commit_message: Update to ${{ needs.release.outputs.version }}
153+
allow_empty_commits: false
154+
updpkgsums: false
155+
156+
copr:
157+
name: Fedora COPR
158+
needs: release
159+
if: needs.release.outputs.publish == 'true'
160+
runs-on: ubuntu-latest
161+
continue-on-error: true
162+
concurrency:
163+
group: copr
164+
cancel-in-progress: false
165+
env:
166+
COPR_CONFIG: ${{ secrets.COPR_CONFIG }}
167+
steps:
168+
- uses: actions/checkout@v7
169+
if: env.COPR_CONFIG != ''
170+
with:
171+
persist-credentials: false
172+
173+
- name: Build the source RPM and submit it to giswqs/rustgis
174+
if: env.COPR_CONFIG != ''
175+
env:
176+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
177+
TAG: ${{ needs.release.outputs.tag }}
178+
VERSION: ${{ needs.release.outputs.version }}
179+
DATE: ${{ needs.release.outputs.date }}
180+
run: |
181+
sudo apt-get update -qq
182+
sudo apt-get install -y -qq rpm appstream
183+
# Pinned: this step holds the COPR token.
184+
pipx install 'copr-cli==2.6'
185+
mkdir -p ~/.config
186+
(umask 077; printf '%s\n' "$COPR_CONFIG" > ~/.config/copr)
187+
188+
src="$HOME/rpmbuild/SOURCES"
189+
packaging/copr/render.sh "$VERSION" "$DATE" "$src"
190+
appstreamcli validate --no-net "$src/org.rustgis.RustGIS.metainfo.xml"
191+
gh release download "$TAG" --repo "$GITHUB_REPOSITORY" --dir "$src" \
192+
--pattern "rustgis-$VERSION-1.x86_64.rpm" --pattern "rustgis-$VERSION-1.aarch64.rpm" \
193+
--pattern SHA256SUMS
194+
(cd "$src" && sha256sum --check --ignore-missing SHA256SUMS)
195+
srpm="$(rpmbuild -bs "$src/rustgis.spec" --define "_topdir $HOME/rpmbuild" | sed -n 's/^Wrote: //p')"
196+
[ -n "$srpm" ] || { echo "::error::rpmbuild wrote no source RPM"; exit 1; }
197+
copr-cli build --nowait giswqs/rustgis "$srpm"
198+
199+
winget:
200+
name: winget
201+
needs: release
202+
if: needs.release.outputs.publish == 'true'
203+
runs-on: ubuntu-latest
204+
continue-on-error: true
205+
concurrency:
206+
group: winget
207+
cancel-in-progress: false
208+
env:
209+
WINGET_TOKEN: ${{ secrets.WINGET_TOKEN }}
210+
steps:
211+
- name: Open a pull request to microsoft/winget-pkgs
212+
if: env.WINGET_TOKEN != ''
213+
# Pinned to a commit: this step receives a token with access to the winget-pkgs fork.
214+
uses: vedantmgoyal9/winget-releaser@f29ed1ffd34f91223a2aebaa71beaab0901ff9fd # v2
215+
with:
216+
identifier: OpenGeos.RustGIS
217+
release-tag: ${{ needs.release.outputs.tag }}
218+
installers-regex: 'windows-x86_64(-setup\.exe|\.msi)$'
219+
fork-user: giswqs
220+
token: ${{ env.WINGET_TOKEN }}

‎README.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ The [user guide](https://rustgis.app/user-guide/) covers each area in detail,
101101
[downloads.rustgis.app](https://downloads.rustgis.app) or the
102102
[latest release](https://github.com/opengeos/RustGIS/releases/latest) (see
103103
[Installation](docs/installation.md) for the files and first-run notes).
104+
- **Package managers**: `winget install OpenGeos.RustGIS`,
105+
`brew install --cask opengeos/rustgis/rustgis`, `yay -S rustgis-bin` (AUR), or
106+
`sudo dnf copr enable giswqs/rustgis && sudo dnf install rustgis` (Fedora).
104107
- **From source**: `cargo run --release -p rustgis` (Rust 1.90 or later).
105108

106109
## Quick start

‎docs/installation.md‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,23 @@ The macOS DMG and command line tool are signed with a Developer ID and notarized
3636
so they open without a warning. The Windows builds are not yet signed: choose
3737
**More info › Run anyway** if SmartScreen warns about an unknown publisher.
3838

39+
## Package managers
40+
41+
RustGIS is also published to these package managers, which keep it up to date:
42+
43+
| Platform | Command |
44+
| --- | --- |
45+
| Windows ([winget](https://learn.microsoft.com/windows/package-manager/)) | `winget install OpenGeos.RustGIS` |
46+
| macOS ([Homebrew](https://brew.sh)) | `brew install --cask opengeos/rustgis/rustgis` |
47+
| macOS and Linux, command line tool only (Homebrew) | `brew install opengeos/rustgis/rustgis-cli` |
48+
| Arch Linux ([AUR](https://aur.archlinux.org/packages/rustgis-bin)) | `yay -S rustgis-bin` (or any AUR helper) |
49+
| Fedora ([COPR](https://copr.fedorainfracloud.org/coprs/giswqs/rustgis/)) | `sudo dnf copr enable giswqs/rustgis && sudo dnf install rustgis` |
50+
51+
winget installs for your account with the setup.exe; add `--scope machine` for the `.msi`. On
52+
Homebrew 5.1 and later, run `brew trust opengeos/rustgis` once before installing from the tap.
53+
Each package is the same build as the release page, and a new release reaches the package
54+
managers shortly after it is published (winget after Microsoft's review).
55+
3956
## From source
4057

4158
RustGIS builds from source with a recent stable Rust toolchain (1.90 or later).

‎packaging/README.md‎

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Packaging
2+
3+
`package.sh` builds the release files for one platform (see its header); the Release workflow
4+
runs it on every platform and attaches the files to the GitHub Release. `downloads/` is the
5+
[downloads.rustgis.app](https://downloads.rustgis.app) site.
6+
7+
## Package managers
8+
9+
After each release build, `.github/workflows/package-managers.yml` publishes the release to four
10+
package managers. Each one repackages the release's own files (nothing is rebuilt), takes its
11+
checksums from the release's `SHA256SUMS`, runs as its own job and skips itself when its secret
12+
is missing. Pre-releases are not published. To republish a release, run the workflow by hand
13+
with its tag.
14+
15+
| Channel | Package | Install | Secret |
16+
| --- | --- | --- | --- |
17+
| Homebrew tap [opengeos/homebrew-rustgis](https://github.com/opengeos/homebrew-rustgis) | cask `rustgis` (the DMGs), formula `rustgis-cli` (macOS and Linux) | `brew install --cask opengeos/rustgis/rustgis` | `HOMEBREW_TAP_DEPLOY_KEY` |
18+
| [AUR](https://aur.archlinux.org/packages/rustgis-bin) | `rustgis-bin` (the .deb files, x86_64 and aarch64) | `yay -S rustgis-bin` | `AUR_SSH_PRIVATE_KEY` |
19+
| [Fedora COPR](https://copr.fedorainfracloud.org/coprs/giswqs/rustgis/) | `rustgis` (the .rpm files plus AppStream metainfo) | `sudo dnf copr enable giswqs/rustgis && sudo dnf install rustgis` | `COPR_CONFIG` |
20+
| [winget](https://github.com/microsoft/winget-pkgs/tree/master/manifests/o/OpenGeos/RustGIS) | `OpenGeos.RustGIS` (setup.exe per user, .msi per machine) | `winget install OpenGeos.RustGIS` | `WINGET_TOKEN` |
21+
22+
Each folder has the script that writes the package for a version:
23+
24+
- `homebrew/render.sh <version> <SHA256SUMS> <tap folder>` writes `Casks/rustgis.rb` and
25+
`Formula/rustgis-cli.rb`.
26+
- `aur/render.sh <version> <SHA256SUMS> > PKGBUILD`.
27+
- `copr/render.sh <version> <date> <folder>` writes `rustgis.spec` and
28+
`org.rustgis.RustGIS.metainfo.xml`. Build the source RPM with both release `.rpm` files in
29+
the same folder.
30+
- `winget/` holds reference copies of the manifests; winget-releaser writes each new version
31+
from the previous one in winget-pkgs.
32+
33+
### Trying a package locally
34+
35+
```sh
36+
gh release download v0.1.0 -R opengeos/RustGIS -p SHA256SUMS
37+
packaging/aur/render.sh 0.1.0 SHA256SUMS > /tmp/aur/PKGBUILD && (cd /tmp/aur && makepkg -si)
38+
packaging/copr/render.sh 0.1.0 2026-10-12 /tmp/copr # then rpmbuild -bs in Fedora
39+
packaging/homebrew/render.sh 0.1.0 SHA256SUMS /tmp/tap && brew style /tmp/tap/Casks/rustgis.rb
40+
```
41+
42+
### Accounts and secrets
43+
44+
- **Homebrew**: the tap repository has a write deploy key; its private half is
45+
`HOMEBREW_TAP_DEPLOY_KEY`. Taps need `brew trust opengeos/rustgis` once on Homebrew 5.1 and
46+
later. The official homebrew/cask repository can take the cask once the repository meets
47+
Homebrew's notability rules (75 stars, 30 days old).
48+
- **AUR**: the maintainer account (giswqs) lists the public half of `AUR_SSH_PRIVATE_KEY` under
49+
*My Account › SSH Public Key*.
50+
- **COPR**: the project `giswqs/rustgis` builds for the Fedora x86_64 and aarch64 chroots.
51+
`COPR_CONFIG` is the whole block from <https://copr.fedorainfracloud.org/api/>; the token
52+
expires after 180 days, so renew the secret when the COPR job fails to authenticate.
53+
- **winget**: `WINGET_TOKEN` is a classic token with the `public_repo` scope for the account
54+
owning the `winget-pkgs` fork (giswqs/winget-pkgs). The first version (0.1.0) was submitted
55+
by hand with `komac submit packaging/winget`.

‎packaging/aur/render.sh‎

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#!/usr/bin/env bash
2+
# Renders the PKGBUILD of the `rustgis-bin` AUR package for one release.
3+
#
4+
# packaging/aur/render.sh <version> <SHA256SUMS> > PKGBUILD
5+
#
6+
# A binary package: it unpacks the release's .deb (x86_64 and aarch64), which already carries
7+
# both programs, the desktop entry, the project file type and the icons, so installing it needs
8+
# no Rust toolchain. The checksums come from the release's SHA256SUMS. REPO defaults to
9+
# opengeos/RustGIS.
10+
set -euo pipefail
11+
12+
version="${1:?usage: render.sh <version> <SHA256SUMS>}"
13+
version="${version#v}"
14+
sums="${2:?usage: render.sh <version> <SHA256SUMS>}"
15+
repo="${REPO:-opengeos/RustGIS}"
16+
17+
# pkgver may not contain a hyphen, so pre-releases are never published.
18+
[[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo "not an X.Y.Z version: $version" >&2; exit 1; }
19+
[[ "$repo" =~ ^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$ ]] || { echo "REPO is not owner/name: $repo" >&2; exit 1; }
20+
21+
sha() {
22+
local h
23+
h="$(awk -v f="$1" '$2 == f || $2 == "*" f { print $1 }' "$sums")"
24+
[[ "$h" =~ ^[0-9a-f]{64}$ ]] || { echo "no checksum for $1 in $sums" >&2; return 1; }
25+
echo "$h"
26+
}
27+
28+
amd64="$(sha "rustgis_${version}_amd64.deb")"
29+
arm64="$(sha "rustgis_${version}_arm64.deb")"
30+
31+
# Escaped \$ stays a makepkg variable in the PKGBUILD.
32+
cat <<PKGBUILD
33+
# Maintainer: Qiusheng Wu <giswqs@gmail.com>
34+
#
35+
# Generated by packaging/aur/render.sh in https://github.com/$repo and published by its
36+
# release workflow; edit the script there, not this file.
37+
pkgname=rustgis-bin
38+
pkgver=$version
39+
pkgrel=1
40+
pkgdesc="Fast, free and open-source GIS for mapping, analyzing and sharing geospatial data"
41+
arch=('x86_64' 'aarch64')
42+
url="https://rustgis.app"
43+
license=('Apache-2.0')
44+
depends=('gcc-libs' 'glibc' 'hicolor-icon-theme' 'libxkbcommon')
45+
# The window system and GPU libraries are loaded at run time.
46+
optdepends=('wayland: Wayland sessions'
47+
'libx11: X11 sessions'
48+
'libxcursor: X11 sessions'
49+
'libxi: X11 sessions'
50+
'libxrandr: X11 sessions'
51+
'libxkbcommon-x11: X11 sessions'
52+
'vulkan-icd-loader: drawing with Vulkan'
53+
'libglvnd: drawing with OpenGL'
54+
'gdal: reading the vector formats GDAL supports')
55+
provides=('rustgis')
56+
conflicts=('rustgis')
57+
options=('!strip' '!debug')
58+
source_x86_64=("rustgis-\${pkgver}-x86_64.deb::https://github.com/$repo/releases/download/v\${pkgver}/rustgis_\${pkgver}_amd64.deb")
59+
source_aarch64=("rustgis-\${pkgver}-aarch64.deb::https://github.com/$repo/releases/download/v\${pkgver}/rustgis_\${pkgver}_arm64.deb")
60+
sha256sums_x86_64=('$amd64')
61+
sha256sums_aarch64=('$arm64')
62+
noextract=("rustgis-\${pkgver}-\${CARCH}.deb")
63+
64+
package() {
65+
cd "\${srcdir}"
66+
# A .deb is an ar archive; the files are in its data.tar (compressed with zstd, xz or gzip).
67+
bsdtar -xf "rustgis-\${pkgver}-\${CARCH}.deb"
68+
local data=(data.tar.*)
69+
[[ -f \${data[0]} ]] || { echo "no data.tar in the .deb" >&2; return 1; }
70+
bsdtar -xpf "\${data[0]}" -C "\${pkgdir}"
71+
# Arch keeps license texts under /usr/share/licenses, not the Debian copyright file.
72+
install -Dm644 "\${pkgdir}/usr/share/doc/rustgis/copyright" "\${pkgdir}/usr/share/licenses/\${pkgname}/LICENSE"
73+
rm -r "\${pkgdir}/usr/share/doc"
74+
}
75+
PKGBUILD

0 commit comments

Comments
 (0)