1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-09-30 19:22:11 +00:00

feat(packaging): use GoReleaser instead of Docker to build RPM/Debian packages

This commit is contained in:
Frédéric Guillot 2025-08-16 19:39:54 -07:00
parent 9e4248c7c1
commit 50520016c8
5 changed files with 162 additions and 4 deletions

92
.github/workflows/packages.yml vendored Normal file
View file

@ -0,0 +1,92 @@
name: RPM and Debian Packages
permissions: read-all
on:
workflow_dispatch:
pull_request:
branches: [ main ]
paths:
- 'packaging/**' # Only run on changes to the packaging files
jobs:
build-packages:
name: Build Packages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Set up Golang
uses: actions/setup-go@v5
with:
go-version: stable
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
version: '~> v2'
args: release -f packaging/goreleaser.yaml --clean ${{ github.event_name == 'pull_request' && '--snapshot' || '' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Cache Packages
uses: actions/cache/save@v4
with:
path: |
dist/*.deb
dist/*.rpm
key: packages-${{ github.run_id }}-${{ github.run_attempt }}
- name: Upload Artifacts
if: github.event_name != 'pull_request'
uses: actions/upload-artifact@v4
with:
name: packages
path: |
dist/*.deb
dist/*.rpm
if-no-files-found: error
retention-days: 1
compression-level: 0
test-debian-package:
name: Test Debian Package
runs-on: ubuntu-latest
needs: build-packages
services:
postgres:
image: postgres:9.5
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: miniflux2
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Restore Packages Cache
uses: actions/cache/restore@v4
with:
path: |
dist/*.deb
dist/*.rpm
key: packages-${{ github.run_id }}-${{ github.run_attempt }}
fail-on-cache-miss: true
- name: Install Debian Package
run: |
sudo apt-get update
sudo dpkg -i dist/miniflux*amd64.deb
- name: Test Installation
run: |
which miniflux
miniflux -i
- name: Test Systemd Service
run: |
# Verify service file exists and is properly installed
systemctl cat miniflux
# Check if service is enabled by default
sudo systemctl is-enabled miniflux || echo "Service not enabled by default"
# Check service status (should be inactive/dead but loadable)
sudo systemctl status miniflux --no-pager || true
# Verify service can be started (will fail due to missing config, but should load)
sudo systemctl start miniflux || echo "Service failed to start (expected without proper config)"
# Check if service is properly defined
systemctl show miniflux --property=Type,ExecStart,User,Group --no-pager

3
.gitignore vendored
View file

@ -1,7 +1,8 @@
./*.sha256
/miniflux
.idea
.vscode
*.deb
*.rpm
/miniflux
dist
miniflux-*

View file

@ -85,7 +85,7 @@ run:
@ LOG_DATE_TIME=1 LOG_LEVEL=debug RUN_MIGRATIONS=1 CREATE_ADMIN=1 ADMIN_USERNAME=admin ADMIN_PASSWORD=test123 go run main.go
clean:
@ rm -f $(APP)-* $(APP) $(APP)*.rpm $(APP)*.deb $(APP)*.exe $(APP)*.sha256
@ rm -rf $(APP)-* $(APP) $(APP)*.rpm $(APP)*.deb $(APP)*.exe $(APP)*.sha256 dist
add-string:
cd internal/locale/translations && \

65
packaging/goreleaser.yaml Normal file
View file

@ -0,0 +1,65 @@
version: 2
builds:
- id: miniflux
binary: miniflux
env:
- CGO_ENABLED=0
goos:
- linux
# We will enable cross-compilation for other OSes later
# - darwin
# - freebsd
# - openbsd
goarch:
- amd64
- arm64
- arm
goarm:
- 6
- 7
ignore:
- goos: darwin
goarch: arm
- goos: darwin
goarch: amd64
- goos: freebsd
goarch: arm64
- goos: freebsd
goarch: arm
- goos: openbsd
goarch: arm64
- goos: openbsd
goarch: arm
ldflags:
- "-s -w -X miniflux.app/v2/internal/version.Version={{.Version}}"
nfpms:
- id: miniflux-packages
package_name: miniflux
vendor: Miniflux
maintainer: "Frédéric Guillot <f@miniflux.net>"
description: "Minimalist and opinionated feed reader"
homepage: "https://miniflux.app/"
license: Apache 2.0
file_name_template: "{{ .PackageName }}_{{ .Version }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}"
formats:
- deb
- rpm
contents:
- src: "./packaging/miniflux.conf"
dst: "/etc/miniflux.conf"
file_info:
mode: 0644
- src: "./packaging/systemd/miniflux.service"
dst: "/etc/systemd/system/miniflux.service"
file_info:
mode: 0644
- src: "./miniflux.1"
dst: "/usr/share/man/man1/miniflux.1"
file_info:
mode: 0644
deb:
lintian_overrides:
- statically-linked-binary
- changelog-file-missing-in-native-package

View file

@ -13,7 +13,7 @@ After=network.target postgresql.service
[Service]
ExecStart=/usr/bin/miniflux
User=miniflux
DynamicUser=yes
# Load environment variables from /etc/miniflux.conf.
EnvironmentFile=/etc/miniflux.conf