No description
Find a file
Leonid Zharikov c784b08c62
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
fix: publish via POST multipart/form-data --data-binary (Sonatype docs)
2026-10-10 04:49:49 +03:00
pkg fix: add trailing newline in DEBIAN/control 2026-10-10 04:25:35 +03:00
.woodpecker.yml fix: publish via POST multipart/form-data --data-binary (Sonatype docs) 2026-10-10 04:49:49 +03:00
README.md fix: publish raw .deb via PUT, update README 2026-10-10 04:48:12 +03:00
test-hello_1.0.0_all.deb build: test-hello_1.0.0_all.deb via nix shell dpkg 2026-10-10 04:39:16 +03:00

test-apt-publish

Тестовый проект для проверки публикации .deb пакетов в Nexus APT через Woodpecker CI.

Структура

test-apt-publish/
├── .woodpecker.yml        # Woodpecker CI pipeline
├── pkg/                   # Исходники пакета (dpkg-deb формат)
│   ├── DEBIAN/
│   │   └── control        # Метаданные пакета
│   └── usr/
│       └── bin/
│           └── test-hello # Исполняемый скрипт

Что делает пайплайн

  1. build — собирает .deb через dpkg-deb --build ./pkg
  2. publish — пушит в Nexus APT репозиторий apt-hosted через curl -F "file=@..."

Предварительные требования (одноразово)

1. Создай APT hosted репозиторий в Nexus

UI: https://nexus.farwydi.dev → Settings → Repositories → Create repository → apt (hosted)

  • Name: apt-hosted
  • Distribution: bookworm (или stable/jammy — твой выбор)
  • Blob store: default
  • Signing key: твой PGP-ключ (ASCII-armored) + passphrase

2. Создай пользователя публикации в Nexus

UI: Settings → Users → Create user

  • Username: nexus-publisher (или своё)
  • Password: сгенерируй сложный
  • Roles: назначь nx-repository-view-apt-apt-hosted-* (или custom role с правами read, write, delete на apt-hosted)

3. Добавь секреты в Woodpecker

UI: https://woodpecker.farwydi.dev → репозиторий test-apt-publish → Settings → Secrets

Secret Значение
nexus_user логин пользователя из п.2
nexus_pass пароль пользователя из п.2

4. Добавь репозиторий в Woodpecker

Woodpecker UI → Repositories → Add → выбери zharikov/test-apt-publish (Forgejo)

Локальная проверка (без CI)

cd test-apt-publish
# Сборка
dpkg-deb --build ./pkg ./test-hello_1.0.0_all.deb

# Проверка
dpkg-deb --info ./test-hello_1.0.0_all.deb
dpkg-deb --contents ./test-hello_1.0.0_all.deb

# Публикация (нужны креденшелы)
curl -u "nexus-publisher:PASSWORD" \
  -T ./test-hello_1.0.0_all.deb \
  "https://nexus.farwydi.dev/repository/apt-hosted/test-hello_1.0.0_all.deb"

Установка с клиента (после публикации)

# 1. Импорт публичного ключа Nexus (с репозитория apt-hosted → Public key)
sudo mkdir -p /etc/apt/keyrings
sudo cp nexus-apt-hosted.gpg /etc/apt/keyrings/nexus-apt.gpg

# 2. Добавление репозитория
echo "deb [signed-by=/etc/apt/keyrings/nexus-apt.gpg] https://nexus.farwydi.dev/repository/apt-hosted/ bookworm main" \
  | sudo tee /etc/apt/sources.list.d/nexus-apt.list

# 3. Аутентификация (если репозиторий приватный)
sudo tee /etc/apt/auth.conf.d/nexus.conf > /dev/null <<'EOF'
machine nexus.farwydi.dev
login nexus-reader
password READER_PASSWORD
EOF
sudo chmod 600 /etc/apt/auth.conf.d/nexus.conf

# 4. Установка
sudo apt update
sudo apt install test-hello
test-hello

Запуск в CI

Просто запушь в Forgejo:

git add test-apt-publish
git commit -m "feat: add test-apt-publish project with Woodpecker CI"
git push forgejo main

Woodpecker автоматически подхватит push, запустит пайплайн и опубликует пакет.

Полезные ссылки