Update workflows to use local actions-checkout action
Some checks failed
Test Forgejo Actions Setup / test-setup (push) Failing after 1s
Some checks failed
Test Forgejo Actions Setup / test-setup (push) Failing after 1s
This commit is contained in:
parent
004fda769c
commit
90bc160d58
2 changed files with 490 additions and 0 deletions
223
.github/workflows/build-deb-simple.yml
vendored
Normal file
223
.github/workflows/build-deb-simple.yml
vendored
Normal file
|
|
@ -0,0 +1,223 @@
|
|||
name: Build Debian Package (Simple)
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, develop ]
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
release:
|
||||
types: [ published ]
|
||||
|
||||
jobs:
|
||||
build-deb:
|
||||
runs-on: ubuntu-24.04
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/actions-checkout@v4
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y \
|
||||
build-essential \
|
||||
devscripts \
|
||||
debhelper \
|
||||
dh-make \
|
||||
fakeroot \
|
||||
lintian \
|
||||
ostree \
|
||||
libostree-dev \
|
||||
git \
|
||||
curl \
|
||||
wget
|
||||
|
||||
- name: Build apt-layer binary
|
||||
run: |
|
||||
make clean
|
||||
make
|
||||
ls -la bin/
|
||||
|
||||
- name: Prepare source for packaging
|
||||
run: |
|
||||
# Create a clean directory for packaging
|
||||
mkdir -p apt-layer-build
|
||||
cd apt-layer-build
|
||||
|
||||
# Copy source files
|
||||
cp -r ../src .
|
||||
cp -r ../include .
|
||||
cp ../Makefile .
|
||||
cp ../README.md .
|
||||
cp ../README-C.md .
|
||||
cp ../LICENSE .
|
||||
|
||||
# Copy binary
|
||||
mkdir -p bin
|
||||
cp ../bin/apt-layer bin/
|
||||
chmod +x bin/apt-layer
|
||||
|
||||
# Create tarball
|
||||
tar -czf apt-layer_1.0.0.orig.tar.gz *
|
||||
|
||||
- name: Create Debian package with dh_make
|
||||
run: |
|
||||
cd apt-layer-build
|
||||
|
||||
# Extract tarball
|
||||
tar -xzf apt-layer_1.0.0.orig.tar.gz
|
||||
|
||||
# Create debian directory
|
||||
dh_make --single --yes --email team@particleos.org --copyright mit
|
||||
|
||||
# Remove template files we don't need
|
||||
rm -f debian/*.ex debian/*.EX debian/*.manpages debian/*.docs
|
||||
|
||||
# Update control file
|
||||
cat > debian/control << 'EOF'
|
||||
Source: apt-layer
|
||||
Section: admin
|
||||
Priority: optional
|
||||
Maintainer: ParticleOS Team <team@particleos.org>
|
||||
Build-Depends: debhelper-compat (= 13), build-essential, ostree, libostree-dev
|
||||
|
||||
Package: apt-layer
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}, ostree, podman | docker.io, build-essential
|
||||
Recommends: git, curl, wget
|
||||
Description: Create OSTree layers using apt packages
|
||||
apt-layer is a tool for creating OSTree layers using apt packages,
|
||||
inspired by rpm-ostree and designed for Ubuntu/Debian-based immutable
|
||||
systems like ParticleOS.
|
||||
.
|
||||
Features:
|
||||
* Layer creation with apt packages
|
||||
* Container-based isolation
|
||||
* OCI export functionality
|
||||
* Layer management and rollback
|
||||
* Recipe support for declarative layers
|
||||
EOF
|
||||
|
||||
# Update changelog
|
||||
cat > debian/changelog << 'EOF'
|
||||
apt-layer (1.0.0-1) unstable; urgency=medium
|
||||
|
||||
* Initial release
|
||||
* C implementation of apt-layer
|
||||
* OSTree layer creation
|
||||
* Container-based builds
|
||||
* OCI export functionality
|
||||
|
||||
-- ParticleOS Team <team@particleos.org> $(date -R)
|
||||
EOF
|
||||
|
||||
# Create rules file
|
||||
cat > debian/rules << 'EOF'
|
||||
#!/usr/bin/make -f
|
||||
|
||||
%:
|
||||
dh $@
|
||||
|
||||
override_dh_auto_install:
|
||||
dh_auto_install
|
||||
# Install binary
|
||||
mkdir -p debian/apt-layer/usr/local/bin
|
||||
cp bin/apt-layer debian/apt-layer/usr/local/bin/
|
||||
chmod +x debian/apt-layer/usr/local/bin/apt-layer
|
||||
|
||||
# Install documentation
|
||||
mkdir -p debian/apt-layer/usr/local/share/doc/apt-layer
|
||||
cp README.md debian/apt-layer/usr/local/share/doc/apt-layer/
|
||||
cp README-C.md debian/apt-layer/usr/local/share/doc/apt-layer/
|
||||
cp LICENSE debian/apt-layer/usr/local/share/doc/apt-layer/
|
||||
|
||||
# Create configuration directory
|
||||
mkdir -p debian/apt-layer/etc/apt-layer
|
||||
cat > debian/apt-layer/etc/apt-layer/config << 'CONFIG_EOF'
|
||||
# apt-layer configuration
|
||||
OSTREE_REPO=/var/lib/apt-layer/ostree-repo
|
||||
BUILD_DIR=/var/lib/apt-layer/build
|
||||
CONTAINER_RUNTIME=podman
|
||||
LOG_LEVEL=info
|
||||
CONFIG_EOF
|
||||
|
||||
# Create data directories
|
||||
mkdir -p debian/apt-layer/var/lib/apt-layer/ostree-repo
|
||||
mkdir -p debian/apt-layer/var/lib/apt-layer/build
|
||||
mkdir -p debian/apt-layer/var/lib/apt-layer/cache
|
||||
|
||||
override_dh_fixperms:
|
||||
dh_fixperms
|
||||
chmod 755 debian/apt-layer/var/lib/apt-layer
|
||||
chmod 755 debian/apt-layer/var/lib/apt-layer/ostree-repo
|
||||
chmod 755 debian/apt-layer/var/lib/apt-layer/build
|
||||
chmod 755 debian/apt-layer/var/lib/apt-layer/cache
|
||||
EOF
|
||||
|
||||
# Create postinst script
|
||||
cat > debian/postinst << 'EOF'
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Update man database if available
|
||||
if command -v mandb >/dev/null 2>&1; then
|
||||
mandb -q
|
||||
fi
|
||||
|
||||
echo "apt-layer installed successfully"
|
||||
echo "Configuration: /etc/apt-layer/config"
|
||||
echo "Data directory: /var/lib/apt-layer"
|
||||
EOF
|
||||
|
||||
# Create postrm script
|
||||
cat > debian/postrm << 'EOF'
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
if [ "$1" = "purge" ]; then
|
||||
echo "Purging apt-layer data..."
|
||||
rm -rf /var/lib/apt-layer
|
||||
rm -rf /etc/apt-layer
|
||||
fi
|
||||
EOF
|
||||
|
||||
# Set permissions
|
||||
chmod +x debian/rules
|
||||
chmod 755 debian/postinst
|
||||
chmod 755 debian/postrm
|
||||
|
||||
# Create conffiles
|
||||
echo "/etc/apt-layer/config" > debian/conffiles
|
||||
|
||||
- name: Build Debian package
|
||||
run: |
|
||||
cd apt-layer-build
|
||||
|
||||
# Build the package
|
||||
dpkg-buildpackage -b -us -uc -rfakeroot
|
||||
|
||||
# Check the package
|
||||
lintian ../apt-layer_1.0.0-1_amd64.deb || true
|
||||
|
||||
- name: Upload package artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: apt-layer-deb
|
||||
path: apt-layer_1.0.0-1_amd64.deb
|
||||
retention-days: 30
|
||||
|
||||
- name: Create release asset (on release)
|
||||
if: github.event_name == 'release'
|
||||
run: |
|
||||
cp apt-layer_1.0.0-1_amd64.deb apt-layer_${{ github.event.release.tag_name }}_amd64.deb
|
||||
|
||||
- name: Upload to release (on release)
|
||||
if: github.event_name == 'release'
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ github.event.release.upload_url }}
|
||||
asset_path: ./apt-layer_${{ github.event.release.tag_name }}_amd64.deb
|
||||
asset_name: apt-layer_${{ github.event.release.tag_name }}_amd64.deb
|
||||
asset_content_type: application/vnd.debian.binary-package
|
||||
Loading…
Add table
Add a link
Reference in a new issue