This repository contains GitHub Actions workflows and a custom action for building and managing packages for the Community repository. The system is designed to handle both AUR (Arch User Repository) packages and custom community packages.
- Overview
- Workflows
- Custom Action
- Usage
- Input Parameters
- Environment Variables
- Secrets
- Build Process Steps
- Customization
- Contributing
This project automates the process of building, signing, and publishing packages for the Community repository. It supports both AUR packages and custom community packages, with different workflows for each type. The action provides visual feedback with a custom blue-based color scheme and integrates with Telegram for status notifications.
File: aur-package-build.yml
This workflow is triggered by repository dispatch events with types starting with 'aur-*' or manually through the workflow dispatch. It's designed to build packages from the Arch User Repository (AUR).
Key features:
- Supports manual and automated triggering
- Uses a custom Docker container (talesam/community-build:1.6.5) for the build environment
- Handles AUR package building, signing, and publishing
- Supports debug sessions with tmate
- Integrates with Telegram for notifications
- Captures and reports build duration
File: build-package.yml
This workflow is for building custom community packages. It can be triggered by repository dispatch events (except those starting with 'aur-*') or manually through the workflow dispatch.
Key features:
- Supports multiple branch types (testing, extra, stable)
- Allows creation of new branches
- Uses a custom Docker container for the build environment
- Handles package building, signing, and publishing
- Supports debug sessions with tmate
- Integrates with Telegram for notifications
- Captures start and end times to calculate build duration
File: action.yml
This is the core action used by both workflows. It defines the steps for building, signing, and publishing packages.
Key features:
- Elegant color-coded terminal output
- Configurable build environment
- Support for custom package repositories
- GPG signing of packages
- Publishing to GitHub releases
- Pushing to custom package repositories
- Updating repository databases
- Cleaning old packages (see below)
- Visual progress tracking with step numbering (steps 1/4 through 4/4)
After uploading, the action runs scripts/update-repository.sh
on the repository server. It:
- keeps only the newest version of each package, compared with
vercmp, as pacman compares them. The package name is everything before the last three fields of the file name (pkgver, pkgrel and arch never contain a hyphen), solinux-big-nvidiaandlinux-big-nvidia-580xxstay two packages; - rebuilds the database aside and moves it into place, so pacman never downloads a missing or half-written one;
- takes a lock (
flock), so builds finishing together update the database one at a time instead of overwriting each other; - fails the build when a package it uploaded is not in the database — for
example because the repository already has a newer version. Publish a
rollback with a higher
pkgrelor anepoch.
The server needs bash, pacman (for repo-add, vercmp and bsdtar) and
flock. Every connection to it is retried, so a server refusing connections
under load delays a build instead of losing it.
Test it locally, on real packages and the real repo-add:
tests/test-update-repository.shEach build has one Telegram message: the first step sends it and every later
step edits it, so the chat shows the build's current step instead of one
message per step. A message that cannot be edited is sent anew, and that one
is edited from then on. tests/test-telegram.sh checks it against a fake Bot
API.
To use these workflows and the custom action in your repository:
- Copy the workflow files (
aur-package-build.ymlandbuild-package.yml) to your.github/workflows/directory. - Copy the
action.ymlfile to the root of your repository. - Set up the required secrets in your GitHub repository settings.
- Trigger the workflows manually or set up repository dispatch events to automate the process.
The custom action supports the following input parameters:
build_env: Build environment (testing, extra, stable, or aur)source: Custom package repo sourcemanjaro_branch: Manjaro branch to buildcustom_repo: Custom repomultilib: Build multilib packagerepo: Package repogpg_key: GPG signing keygpg_passphrase: GPG passphrasegit_branch: Extra repository to build packageextra_command: Extra command to run before buildingextra_package: Extra package to buildtmate: Run tmate for debuggingrepo_mirror: Mirror to use in buildrepo_dev: Development repositorypacman_mirror: Specific mirror to override automatic selectionpublish_github: Publish package on GitHubpush_to_repo: Push package to repositoryupdate_db: Update repository databaserepo_host: Repository hostrepo_user: Repository userrepo_port: Repository portrepo_dir: Repository directorygithub_token: GitHub token for authenticationtelegram_token: Telegram bot token for notificationstelegram_chat_id: Telegram chat ID for notificationsbranch_type: Branch type (testing, extra or stable)url: Repository URLnew_branch: Name of the new branchpackage_name: Package nameaur_package_dir: Directory containing the AUR packagestart_time: Workflow start timestart_timestamp: Workflow start timestamp as epoch secondsrepo_origem: Source repositorybranch_fullname: Full name of the source branch
The workflows use the following environment variables:
PACKAGE_NAME: Name of the package to buildAUR_URL: URL of the AUR packageBRANCH_TYPE: Type of branch (aur, testing, extra, stable)BUILD_ENV: Build environmentNEW_BRANCH: Name of the new branch to create or useTELEGRAM_TOKEN: Telegram bot token for notificationsCHAT_ID: Telegram chat ID for notificationsBRANCH_ORIGEM: Origin branch nameREPO_ORIGEM: Origin repository URLREPO_NAME: Repository nameBRANCH_FULLNAME: Full name of the branch of origin
The following secrets are required:
PKGBUILD_KEY: SSH key for accessing the package build serverGITHUB_TOKEN: GitHub authentication tokenGPG_PRIVATE_KEY: GPG private key for signing packagesPASSPHRASE: Passphrase for the GPG keyTOKEN_BOT: Telegram bot tokenCHAT_ID: Telegram chat ID for notificationsPKGBUILD_HOST: Hostname of the package build serverPKGBUILD_USER: Username for the package build serverPKGBUILD_PORT: SSH port for the package build serverPKGBUILD_DIR: Directory on the build server for storing packagesREPOSITORY_TOKEN: Token for repository operations (optional)ORGANIZATION_TOKEN: Token for organization operations (optional)
The build process is divided into 4 main steps:
- Set up the build environment
- Clone source repository
- Configure system and repositories
- Import GPG key
- Build the package using makepkg
- Sign the package with GPG
- Generate checksums
- Push the package to the repository
- Clean old package versions
- Update repository database
- Prepare package for release (7z compression if needed)
- Create GitHub release (if enabled)
- Calculate and report build duration
- Send completion notification
The process includes elegant terminal output with color-coded messages and detailed progress tracking through Telegram notifications.
You can customize the build process by:
- Modifying the
action.ymlfile to add or remove steps - Adjusting the input parameters in the workflow files
- Changing the Docker image used for the build environment
- Adding custom commands in the
extra_commandinput - Customizing the color palette for terminal output
Contributions to improve the workflows or the custom action are welcome. Please submit pull requests or open issues to discuss potential changes or improvements.