mirror of
https://github.com/johndoe6345789/SparkOS.git
synced 2026-04-24 13:34:56 +00:00
Merge pull request #17 from johndoe6345789/copilot/ci-cd-compiled-release-zip
Add CI/CD workflow for compiled release artifacts
This commit is contained in:
229
.github/workflows/release.yml
vendored
Normal file
229
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,229 @@
|
||||
name: Build and Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- develop
|
||||
tags:
|
||||
- 'v*'
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- develop
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-release:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up build environment
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y gcc make
|
||||
|
||||
- name: Build init binary
|
||||
run: |
|
||||
echo "Building SparkOS init system..."
|
||||
make init
|
||||
echo "Build complete!"
|
||||
|
||||
- name: Verify build
|
||||
run: |
|
||||
echo "Verifying init binary..."
|
||||
if [ ! -f init ]; then
|
||||
echo "ERROR: init binary not found!"
|
||||
exit 1
|
||||
fi
|
||||
ls -lh init
|
||||
file init
|
||||
ldd init 2>&1 || echo "Static binary (no dependencies)"
|
||||
echo "Verification complete!"
|
||||
|
||||
- name: Prepare release package
|
||||
run: |
|
||||
echo "Preparing release package..."
|
||||
mkdir -p release/sparkos
|
||||
|
||||
# Copy compiled binary
|
||||
cp init release/sparkos/
|
||||
|
||||
# Copy essential files
|
||||
cp README.md release/sparkos/
|
||||
cp LICENSE release/sparkos/
|
||||
cp ARCHITECTURE.md release/sparkos/
|
||||
cp CONTRIBUTING.md release/sparkos/
|
||||
cp Makefile release/sparkos/
|
||||
|
||||
# Copy source for reference
|
||||
cp -r src release/sparkos/
|
||||
|
||||
# Copy scripts
|
||||
cp -r scripts release/sparkos/
|
||||
|
||||
# Copy config
|
||||
cp -r config release/sparkos/
|
||||
|
||||
# Copy rootfs structure (without generated content)
|
||||
mkdir -p release/sparkos/rootfs
|
||||
# Copy rootfs directories if they exist (some may not be populated)
|
||||
for dir in etc root home; do
|
||||
if [ -d "rootfs/$dir" ]; then
|
||||
cp -r "rootfs/$dir" release/sparkos/rootfs/
|
||||
else
|
||||
echo "Note: rootfs/$dir does not exist, skipping"
|
||||
fi
|
||||
done
|
||||
|
||||
# Create README for the release
|
||||
cat > release/sparkos/RELEASE_README.md << 'HEREDOC_EOF'
|
||||
# SparkOS Release Package
|
||||
|
||||
This package contains the compiled SparkOS init system and all necessary files to run or build SparkOS.
|
||||
|
||||
## Contents
|
||||
|
||||
- \`init\` - The compiled init binary (statically linked)
|
||||
- \`src/\` - Source code for the init system
|
||||
- \`scripts/\` - Build and setup scripts
|
||||
- \`config/\` - Configuration files
|
||||
- \`rootfs/\` - Root filesystem structure
|
||||
- \`Makefile\` - Build system
|
||||
- Documentation files (README.md, ARCHITECTURE.md, etc.)
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Using the Pre-built Binary
|
||||
|
||||
The \`init\` binary is already compiled and ready to use:
|
||||
|
||||
\`\`\`bash
|
||||
# Copy to your rootfs
|
||||
cp init /path/to/your/rootfs/sbin/init
|
||||
chmod 755 /path/to/your/rootfs/sbin/init
|
||||
\`\`\`
|
||||
|
||||
### Rebuilding from Source
|
||||
|
||||
If you need to rebuild:
|
||||
|
||||
\`\`\`bash
|
||||
# Build the init system
|
||||
make init
|
||||
|
||||
# Install to rootfs
|
||||
make install
|
||||
\`\`\`
|
||||
|
||||
### Creating a Bootable System
|
||||
|
||||
Follow the instructions in README.md to create a complete bootable system.
|
||||
|
||||
## System Requirements
|
||||
|
||||
- Linux system with kernel 3.x or later
|
||||
- Busybox for shell and utilities
|
||||
- For building: GCC compiler, Make
|
||||
|
||||
## Documentation
|
||||
|
||||
See README.md for complete documentation, including:
|
||||
- Building instructions
|
||||
- Creating bootable images
|
||||
- Network configuration
|
||||
- Development guidelines
|
||||
|
||||
## Support
|
||||
|
||||
For issues and questions, visit: https://github.com/johndoe6345789/SparkOS
|
||||
HEREDOC_EOF
|
||||
|
||||
echo "Package prepared in release/sparkos/"
|
||||
ls -la release/sparkos/
|
||||
|
||||
- name: Create release archive
|
||||
run: |
|
||||
echo "Creating release archive..."
|
||||
cd release
|
||||
zip -r ../sparkos-release.zip sparkos/
|
||||
cd ..
|
||||
echo "Archive created!"
|
||||
ls -lh sparkos-release.zip
|
||||
unzip -l sparkos-release.zip | head -30
|
||||
|
||||
- name: Upload release artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: sparkos-release-${{ github.sha }}
|
||||
path: sparkos-release.zip
|
||||
retention-days: 90
|
||||
|
||||
- name: Create GitHub Release
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
files: sparkos-release.zip
|
||||
body: |
|
||||
# SparkOS Release ${{ github.ref_name }}
|
||||
|
||||
This release includes:
|
||||
- Pre-compiled init binary (statically linked)
|
||||
- Complete source code
|
||||
- Build scripts and configuration
|
||||
- Root filesystem structure
|
||||
- Documentation
|
||||
|
||||
## Quick Start
|
||||
|
||||
1. Download `sparkos-release.zip`
|
||||
2. Extract the archive
|
||||
3. Use the pre-built `init` binary or rebuild from source
|
||||
4. Follow README.md for complete setup instructions
|
||||
|
||||
## Docker Image
|
||||
|
||||
A Docker image is also available:
|
||||
```bash
|
||||
docker pull ghcr.io/johndoe6345789/sparkos:${{ github.ref_name }}
|
||||
```
|
||||
|
||||
## What's Changed
|
||||
|
||||
See commit history for detailed changes.
|
||||
draft: false
|
||||
prerelease: false
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Output summary
|
||||
run: |
|
||||
echo "### Build and Release Summary 📦" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "**Status:** ✅ Success" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "**Init Binary:**" >> $GITHUB_STEP_SUMMARY
|
||||
echo '```' >> $GITHUB_STEP_SUMMARY
|
||||
ls -lh init >> $GITHUB_STEP_SUMMARY
|
||||
echo '```' >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "**Release Archive:**" >> $GITHUB_STEP_SUMMARY
|
||||
echo '```' >> $GITHUB_STEP_SUMMARY
|
||||
ls -lh sparkos-release.zip >> $GITHUB_STEP_SUMMARY
|
||||
echo '```' >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
|
||||
echo "**Release:** Created GitHub release for ${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY
|
||||
else
|
||||
echo "**Artifact:** Uploaded as workflow artifact (available for 90 days)" >> $GITHUB_STEP_SUMMARY
|
||||
fi
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "**Archive Contents (preview):**" >> $GITHUB_STEP_SUMMARY
|
||||
echo '```' >> $GITHUB_STEP_SUMMARY
|
||||
unzip -l sparkos-release.zip | head -30 >> $GITHUB_STEP_SUMMARY
|
||||
echo '```' >> $GITHUB_STEP_SUMMARY
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -45,6 +45,8 @@ build/
|
||||
init
|
||||
*.img
|
||||
*.iso
|
||||
*.zip
|
||||
release/
|
||||
|
||||
# Temporary files
|
||||
/tmp/
|
||||
|
||||
39
README.md
39
README.md
@@ -25,6 +25,8 @@ The current MVP provides:
|
||||
- ✅ Docker container for testing
|
||||
- ✅ Automated builds and publishing to GHCR
|
||||
- ✅ Multi-architecture Docker images (AMD64 and ARM64)
|
||||
- ✅ CI/CD pipeline for compiled release packages
|
||||
- ✅ GitHub releases with pre-built binaries
|
||||
|
||||
## Prerequisites
|
||||
|
||||
@@ -43,6 +45,32 @@ To create bootable images (optional):
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Using Pre-built Releases (Easiest)
|
||||
|
||||
Download the latest release package from the [GitHub Releases page](https://github.com/johndoe6345789/SparkOS/releases):
|
||||
|
||||
```bash
|
||||
# Download the latest release (replace VERSION with actual version, e.g., v1.0.0)
|
||||
wget https://github.com/johndoe6345789/SparkOS/releases/download/VERSION/sparkos-release.zip
|
||||
|
||||
# Extract the package
|
||||
unzip sparkos-release.zip
|
||||
cd sparkos/
|
||||
|
||||
# The init binary is already compiled and ready to use
|
||||
ls -lh init
|
||||
|
||||
# Copy to your rootfs or use directly
|
||||
cp init /path/to/your/rootfs/sbin/init
|
||||
```
|
||||
|
||||
The release package includes:
|
||||
- Pre-compiled init binary (statically linked, ready to use)
|
||||
- Complete source code
|
||||
- Build scripts and configuration
|
||||
- Root filesystem structure
|
||||
- Full documentation
|
||||
|
||||
### Using Docker (Recommended for Testing)
|
||||
|
||||
The easiest way to test SparkOS is using the pre-built Docker image from GitHub Container Registry:
|
||||
@@ -187,10 +215,17 @@ SparkOS uses GitHub Actions for continuous integration and delivery:
|
||||
|
||||
**Automated Builds:**
|
||||
- Docker images are automatically built on every push to main/develop branches
|
||||
- Images are also built for pull requests (testing only, not published)
|
||||
- Tagged releases automatically create versioned Docker images
|
||||
- Compiled release packages are automatically built on every push to main/develop branches
|
||||
- Both are also built for pull requests (testing only, not published)
|
||||
- Tagged releases automatically create versioned Docker images and GitHub releases with compiled binaries
|
||||
- **Multi-architecture builds**: Images are built for both AMD64 (x86_64) and ARM64 (aarch64)
|
||||
|
||||
**Compiled Releases:**
|
||||
- Pre-compiled init binaries are available as GitHub releases for version tags
|
||||
- Release packages include: compiled init binary, source code, build scripts, and documentation
|
||||
- Download releases from the [GitHub Releases page](https://github.com/johndoe6345789/SparkOS/releases)
|
||||
- Build artifacts are available for all workflow runs (retained for 90 days)
|
||||
|
||||
**Container Registry:**
|
||||
- Images are published to GitHub Container Registry (GHCR)
|
||||
- Pull images: `docker pull ghcr.io/johndoe6345789/sparkos:latest`
|
||||
|
||||
Reference in New Issue
Block a user