feat: external project build template

This commit is contained in:
pips 2025-09-22 13:31:02 +02:00
commit e4a92d0ecf
6 changed files with 109 additions and 0 deletions

27
.editorconfig Normal file
View file

@ -0,0 +1,27 @@
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 4
[COMMIT_EDITMSG]
indent_size = 4
indent_style = space
max_line_length = 80
[control]
trim_trailing_whitespace = false
[Makefile]
indent_style = tab
[*.md]
max_line_length = 80
[*.{yml,yaml}]
indent_size = 2
[*.patch]
trim_trailing_whitespace = false

40
.woodpecker/build.yaml Normal file
View file

@ -0,0 +1,40 @@
when:
- event: push
branch: ${CI_REPO_DEFAULT_BRANCH}
- event: pull_request
steps:
- name: builder
image: woodpeckerci/plugin-kaniko:1.3.0
when:
- path: Dockerfile.builder
event: push
branch: ${CI_REPO_DEFAULT_BRANCH}
settings:
registry: ${CI_FORGE_URL##https://}
repo: ${CI_REPO_OWNER}/${CI_REPO_NAME}-builder
dockerfile: Dockerfile.builder
username: CIBot
password:
from_secret: package_token
- name: compile
image: ${CI_FORGE_URL##https://}/${CI_REPO_OWNER}/${CI_REPO_NAME}-builder
when:
- event: push
branch: ${CI_REPO_DEFAULT_BRANCH}
- event: pull_request
commands:
- make compile
- name: dpkg
image: ubuntu:24.04
when:
- event: push
branch: ${CI_REPO_DEFAULT_BRANCH}
depends_on: compile
commands:
- make dpkg
environment:
password:
from_secret: package_token
commit_abbrev: ${CI_COMMIT_SHA:0:7}

8
Dockerfile.builder Normal file
View file

@ -0,0 +1,8 @@
# use specific image if relevant (rust, golang)
FROM ubuntu:24.04
RUN apt-get update && \
apt-get install curl \
# other packages to build \

16
Makefile Normal file
View file

@ -0,0 +1,16 @@
package = mypackage.deb
.PHONY: compile
compile:
cd upstream && echo compile
.PHONY: dpkg
dpkg:
make -p deb-packagee/usr/bin/
cp upstream/bin deb-package/usr/bin/
chmod -R o-w deb-package/
sed -i "s|%date%|`date +%Y%m%d`|g" deb-package/DEBIAN/control
sed -i "s|%hash%|$(commit_abbrev)|g" deb-package/DEBIAN/control
dpkg-deb --build deb-package/ $(package)
@curl --user CIBot:$(PASSWORD) $(package) $(CI_FORGE_URL)/api/packages/$(CI_REPO_OWNER)/debian/pool/noble/main/upload

6
README.md Normal file
View file

@ -0,0 +1,6 @@
# Template for external project package building
- git submodule add <https://repo.example.com/external/repo.git> upstream
- Makefile: change package name & compile / dpkg target instructions
- Dockerfile.builder: required deb packages / base image
- deb-package/DEBIAN/control: Package name, depends, conflict & description

View file

@ -0,0 +1,12 @@
Package: mypackage-main
Version: 0.0.1~git%date%.%hash%-1
Section: base
Priority: optional
Architecture: amd64
Maintainer: pips <pips@e5150.fr>
Homepage: https://example.com
Suggests: suggeted-packages
Depends: depends (>= X.Y.Z), packages (>= X.Y)
Conflicts: package-from-official-repo
Description: Description of mypackage
Auto packaging of mypackage following main dev branch