Skip to content

Commit

Permalink
Add workflow for automated builds
Browse files Browse the repository at this point in the history
  • Loading branch information
iliajie committed Jan 26, 2025
1 parent 13ab940 commit 44fdb23
Showing 1 changed file with 93 additions and 0 deletions.
93 changes: 93 additions & 0 deletions .github/workflows/virtualmin.dev+virtualmin-core-meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: "virtualmin.dev: virtualmin/virtualmin-core-meta"

on:
push:
branches:
- master
release:
types:
- published
- edited

env:
PKG_RELEASE: "1"
PKG_SUMMARY: "Installs required dependencies for Virtualmin"
PKG_DESC: "A dummy package designed to pull in all core dependencies. It installs everything needed to set up the Virtualmin core system."
PKG_HOMEPAGE: "https://github.com/virtualmin/virtualmin-core-meta"
IS_RELEASE: ${{ github.event_name == 'release' }}

BUILD_DEPS: "tar curl gzip dpkg-dev fakeroot build-essential coreutils"
BUILD_BOOTSTRAP: "https://raw.githubusercontent.com/webmin/webmin-ci-cd/main/build/bootstrap.bash"

jobs:
build-amd64:
runs-on: ubuntu-latest
if: ${{ !contains(github.event.head_commit.message, '[no-build]') }}
env:
TZ: Europe/Nicosia
steps:
- uses: actions/checkout@v4

- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: ${{ env.BUILD_DEPS }}
version: 1.0

- name: Fetch dependencies
run: curl -O ${{ env.BUILD_BOOTSTRAP }}

- name: Set timezone
run: sudo timedatectl set-timezone ${{ env.TZ }}

- name: Build packages
env:
CLOUD__GPG_PH: ${{ secrets.DEV_GPG_PH }}
CLOUD__IP_ADDR: ${{ secrets.DEV_IP_ADDR }}
CLOUD__IP_KNOWN_HOSTS: ${{ secrets.DEV_IP_KNOWN_HOSTS }}
CLOUD__UPLOAD_SSH_USER: ${{ secrets.DEV_UPLOAD_SSH_USER }}
CLOUD__UPLOAD_SSH_DIR: ${{ env.IS_RELEASE == 'true' && secrets.PRERELEASE_UPLOAD_SSH_DIR || secrets.DEV_UPLOAD_SSH_DIR }}
CLOUD__SSH_PRV_KEY: ${{ secrets.DEV_SSH_PRV_KEY }}
CLOUD__SIGN_BUILD_REPOS_CMD: ${{ secrets.DEV_SIGN_BUILD_REPOS_CMD }}
run: |-
set -euo pipefail
# Check testing flag
testing=$([[ "${{ env.IS_RELEASE }}" == "false" ]] && echo "--testing" || echo "")
# Bootstrap build
source bootstrap.bash "$testing"
# Parse debian control and build packages
while IFS= read -r line; do
result+=("$line")
done < <(parse_debian_control "." "$testing")
for ((i = 0; i < ${#result[@]}; i += 6)); do
pkg_name="${result[i]}"
pkg_version="${result[i+1]}"
pkg_depends="${result[i+2]}"
pkg_recommends="${result[i+3]}"
pkg_suggests="${result[i+4]}"
pkg_replaces="${result[i+5]}"
build_native_package \
--architectures noarch \
--target-dir "$ROOT_REPOS" \
--base-name "$pkg_name" \
--version "$pkg_version" \
--release "${{ env.PKG_RELEASE }}" \
--depends "$pkg_depends" \
--recommends "$pkg_recommends" \
--suggests "$pkg_suggests" \
--replaces "$pkg_replaces" \
--skip rpm \
--summary "${{ env.PKG_SUMMARY }}" \
--description "${{ env.PKG_DESC }}" \
--homepage "${{ env.PKG_HOMEPAGE }}"
done
# Upload and sign
upload_list=("$ROOT_REPOS/"*)
cloud_upload upload_list
cloud_sign_and_build_repos virtualmin.dev

0 comments on commit 44fdb23

Please sign in to comment.