Package GitHub releases using nFPM
Project description
gh-nfpm
Easily package GitHub releases using nFPM.
Currently only supports building the latest GitHub release.
tl;dr You specify a GitHub repository, a list of release assets, and the nFPM packaging configuration. gh-nfpm will download the matching assets from the latest GitHub release in the repository and build an nFPM package for each asset. You can build multiple package types for each asset.
Configuration
The configuration is stored inside a YAML file called gh-nfpm.yaml.
Repository and assets
The repository is specified with a string organization/repository, for
example this repository would be nossralf/gh-nfpm.
Asset matching supports literal matches or regular expressions. Currently only
tar.gz and zip assets are supported as package sources.
The shorthand format is literal matching, so:
assets:
- release.zip
- release.tar.gz
would match release assets named exactly release.zip and release.tar.gz.
Regular expressions can be used for cases where the release asset contains a version number:
assets:
- match:
kind: regex
pattern: ".*-aarch64-unknown-linux-musl.tar.gz$"
This would match my-tool-3.14.15-aarch64-unknown-linux-musl.tar.gz.
If the architecture cannot be deduced from the asset name, it can be specified as part of the asset configuration, for example with a literal match (which needs to use the verbose format when specifying an architecture):
assets:
- arch: all
match:
kind: literal
pattern: architecture-independent-release.tar.gz
gh-nfpm will verify the digest of downloaded assets if one is present in the GitHub API response. It will abort if a digest doesn't match.
Packagers
The packagers list specifies which nFPM packagers should be run for each
asset. The supported values are apk, archlinux, deb, ipk, msix,
rpm, and srpm.
Release cooldown
Release cooldown is supported by setting cooldown, either as an integer
representing seconds, or as an ISO 8601
duration, for example P1W
for one week, P2D for 2 days, or PT12H for 12 hours. The last update of
the GitHub release is used when evaluating the cooldown.
Other configuration options
tokensets the GitHub token used to interact with GitHub. By default, unauthenticated access is used. It can also be set via the environment variableGHNFPM_TOKENto avoid hard-coding credentials in the configuration file.nfpm_executablecan be set to specify the path to nFPM. By default gh-nfpm will assume that annpfmbinary can be found via$PATH.
nFPM configuration
The nFPM configuration is stored under a top-level key nfpm in the
gh-nfpm.yaml configuration file. The complete nFPM configuration schema is
supported and the content is validated with the nFPM JSON Schema.
The version and arch fields can be left out of the nFPM configuration and
will then be filled in based on the release name and architecture from the
release assets. If you do specify the version or the architecture, the value
you specify will always be used when building the package.
Source paths
gh-nfpm will unpack the release assets by stripping off any leading directories that don't contain files inside the asset, to avoid situations where e.g. directories with version numbers would make static packaging configuration impossible.
This means that if a release asset contains this directory structure:
.
└── release
└── 0.13
├── completions
│ └── tool.1
└── tool
gh-nfpm will strip the leading release/0.13 and unpack the asset like this:
.
├── completions
│ └── tool.1
└── tool
This enables specifying tool as the source path in nFPM's content
specification, instead of release/0.13/tool.
Example
This is how you would build Debian packages (both x86-64 and AArch64) for uv with a 2 day release cooldown.
repository: astral-sh/uv
cooldown: P2D
assets:
- uv-x86_64-unknown-linux-musl.tar.gz
- uv-aarch64-unknown-linux-musl.tar.gz
packagers:
- deb
nfpm:
name: uv
platform: linux
section: python
description: |-
An extremely fast Python package and project manager, written in Rust.
homepage: https://docs.astral.sh/uv/
maintainer: Mackenzie Maintainer <mackenzie@example.com>
license: MIT or Apache-2.0
contents:
- src: uv
dst: /usr/bin/uv
- src: uvx
dst: /usr/bin/uvx
Usage
Create a gh-nfpm.yaml file, then run uvx gh-nfpm. The built packages will be
placed in the current directory.
If you don't have nFPM installed, you can run uvx 'gh-nfpm[npfm]' and nFPM
will be installed via the nfpmPython
package. Be aware that the npfm PyPI package
is not provided by the nFPM team.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gh_nfpm-0.1.0.tar.gz.
File metadata
- Download URL: gh_nfpm-0.1.0.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40affcbd4e0a8e2679c55e4562a0a6a2d206b619258a78038a81ef73fc29a481
|
|
| MD5 |
ec605559dc60e784dcee3b0879a1e9f0
|
|
| BLAKE2b-256 |
d6b91fed9dc5b8266d24723b290aeceeca49f9e5d346bbe157e2c9aae91875b3
|
File details
Details for the file gh_nfpm-0.1.0-py3-none-any.whl.
File metadata
- Download URL: gh_nfpm-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e850517fe151700b1ce77c11be37aa59bf0cad68ca11bcdeaa6be6a7b657acd
|
|
| MD5 |
f5fec465f60c503ede44ddf9bcb427f7
|
|
| BLAKE2b-256 |
bfd5b4d18cd8d04e08e327e947a401a3f0683e38c5c86d37f060f938f469c282
|