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
|
||||||
267
.github/workflows/build-deb.yml
vendored
Normal file
267
.github/workflows/build-deb.yml
vendored
Normal file
|
|
@ -0,0 +1,267 @@
|
||||||
|
name: Build Debian Package
|
||||||
|
|
||||||
|
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: Create Debian package structure
|
||||||
|
run: |
|
||||||
|
# Create package directory
|
||||||
|
mkdir -p apt-layer-1.0.0
|
||||||
|
cd apt-layer-1.0.0
|
||||||
|
|
||||||
|
# Copy binary and create directory structure
|
||||||
|
mkdir -p usr/local/bin
|
||||||
|
mkdir -p usr/local/share/apt-layer
|
||||||
|
mkdir -p usr/local/share/doc/apt-layer
|
||||||
|
mkdir -p usr/local/share/man/man1
|
||||||
|
mkdir -p etc/apt-layer
|
||||||
|
|
||||||
|
# Copy binary
|
||||||
|
cp ../../bin/apt-layer usr/local/bin/
|
||||||
|
chmod +x usr/local/bin/apt-layer
|
||||||
|
|
||||||
|
# Copy documentation
|
||||||
|
cp ../../README.md usr/local/share/doc/apt-layer/
|
||||||
|
cp ../../README-C.md usr/local/share/doc/apt-layer/
|
||||||
|
cp ../../LICENSE usr/local/share/doc/apt-layer/
|
||||||
|
|
||||||
|
# Create man page
|
||||||
|
cat > usr/local/share/man/man1/apt-layer.1 << 'EOF'
|
||||||
|
.TH APT-LAYER 1 "2024" "apt-layer" "User Commands"
|
||||||
|
.SH NAME
|
||||||
|
apt-layer \- Create OSTree layers using apt packages
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.B apt-layer
|
||||||
|
[\fIOPTIONS\fR] \fIBASE-BRANCH\fR \fINEW-BRANCH\fR [\fIPACKAGES\fR...]
|
||||||
|
.SH DESCRIPTION
|
||||||
|
apt-layer is a tool for creating OSTree layers using apt packages, inspired by rpm-ostree.
|
||||||
|
.SH OPTIONS
|
||||||
|
.TP
|
||||||
|
.B \-\-help
|
||||||
|
Show help message
|
||||||
|
.TP
|
||||||
|
.B \-\-version
|
||||||
|
Show version information
|
||||||
|
.TP
|
||||||
|
.B \-\-list
|
||||||
|
List available branches
|
||||||
|
.TP
|
||||||
|
.B \-\-info \fIBRANCH\fR
|
||||||
|
Show information about a branch
|
||||||
|
.TP
|
||||||
|
.B \-\-container
|
||||||
|
Use container-based layer creation
|
||||||
|
.TP
|
||||||
|
.B \-\-oci-export \fIBRANCH\fR \fIIMAGE-NAME\fR
|
||||||
|
Export branch as OCI image
|
||||||
|
.SH EXAMPLES
|
||||||
|
.TP
|
||||||
|
Create a gaming layer:
|
||||||
|
.B apt-layer particleos/base/trixie particleos/gaming/trixie steam wine
|
||||||
|
.TP
|
||||||
|
Create container-based layer:
|
||||||
|
.B apt-layer \-\-container particleos/base/trixie particleos/gaming/trixie steam wine
|
||||||
|
.SH AUTHOR
|
||||||
|
Written for ParticleOS project
|
||||||
|
.SH BUGS
|
||||||
|
Report bugs to the ParticleOS project
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Create configuration file
|
||||||
|
cat > etc/apt-layer/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
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Create postinst script
|
||||||
|
cat > DEBIAN/postinst << 'EOF'
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Create directories
|
||||||
|
mkdir -p /var/lib/apt-layer/ostree-repo
|
||||||
|
mkdir -p /var/lib/apt-layer/build
|
||||||
|
mkdir -p /var/lib/apt-layer/cache
|
||||||
|
|
||||||
|
# Set permissions
|
||||||
|
chown -R root:root /var/lib/apt-layer
|
||||||
|
chmod 755 /var/lib/apt-layer
|
||||||
|
chmod 755 /var/lib/apt-layer/ostree-repo
|
||||||
|
chmod 755 /var/lib/apt-layer/build
|
||||||
|
chmod 755 /var/lib/apt-layer/cache
|
||||||
|
|
||||||
|
# Update man database
|
||||||
|
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 prerm script
|
||||||
|
cat > DEBIAN/prerm << 'EOF'
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo "Removing 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 755 DEBIAN/postinst
|
||||||
|
chmod 755 DEBIAN/prerm
|
||||||
|
chmod 755 DEBIAN/postrm
|
||||||
|
|
||||||
|
# Create control file
|
||||||
|
cat > DEBIAN/control << 'EOF'
|
||||||
|
Package: apt-layer
|
||||||
|
Version: 1.0.0
|
||||||
|
Section: admin
|
||||||
|
Priority: optional
|
||||||
|
Architecture: amd64
|
||||||
|
Depends: ostree, podman | docker.io, build-essential
|
||||||
|
Recommends: git, curl, wget
|
||||||
|
Maintainer: ParticleOS Team <team@particleos.org>
|
||||||
|
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
|
||||||
|
|
||||||
|
# Create changelog
|
||||||
|
cat > DEBIAN/changelog << 'EOF'
|
||||||
|
apt-layer (1.0.0) 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 copyright
|
||||||
|
cat > DEBIAN/copyright << 'EOF'
|
||||||
|
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||||
|
Upstream-Name: apt-layer
|
||||||
|
Source: https://github.com/particleos/apt-layer
|
||||||
|
|
||||||
|
Files: *
|
||||||
|
Copyright: 2024 ParticleOS Team
|
||||||
|
License: MIT
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
.
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
.
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Create conffiles
|
||||||
|
echo "/etc/apt-layer/config" > DEBIAN/conffiles
|
||||||
|
|
||||||
|
# Create md5sums
|
||||||
|
find usr etc -type f -exec md5sum {} \; > DEBIAN/md5sums
|
||||||
|
|
||||||
|
- name: Build Debian package
|
||||||
|
run: |
|
||||||
|
cd apt-layer-1.0.0
|
||||||
|
|
||||||
|
# Build the package
|
||||||
|
dpkg-buildpackage -b -us -uc -rfakeroot
|
||||||
|
|
||||||
|
# Check the package
|
||||||
|
lintian ../apt-layer_1.0.0_amd64.deb || true
|
||||||
|
|
||||||
|
- name: Upload package artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: apt-layer-deb
|
||||||
|
path: apt-layer_1.0.0_amd64.deb
|
||||||
|
retention-days: 30
|
||||||
|
|
||||||
|
- name: Create release asset (on release)
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
run: |
|
||||||
|
cp apt-layer_1.0.0_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