Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions .github/actions/build-deb/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: "Build Debian packages with Podman"
description: "Builds Debian packages for amd64 and arm64"
author: "Thomas Willetal"

inputs:
path:
description: "Path to the Debian package directory (for changelog parsing)"
required: true

outputs:
version:
description: "Parsed Debian version from changelog"
value: ${{ steps.changelog.outputs.version }}

runs:
using: "composite"
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install dependencies (Podman, Python, dpkg-dev)
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y podman python3-pip dpkg-dev

- name: Install podman-compose from PyPI
shell: bash
run: |
pip install --upgrade pip
pip install podman-compose

- name: Verify Podman and podman-compose
shell: bash
run: |
podman --version
podman-compose version

- name: Prepare build environment
shell: bash
run: make builder

- name: Build amd64 package
shell: bash
run: make amd64-debbuild

- name: Build arm64 package
shell: bash
run: make arm64-debbuild

- name: Get Debian version
id: changelog
uses: ./.github/actions/get-deb-version
with:
path: ${{ inputs.path }}

- name: Show parsed version
shell: bash
run: echo "Version=${{ steps.changelog.outputs.version }}"

- name: Upload build artifacts
if: success()
uses: actions/upload-artifact@v4
with:
name: uds-daemon-example-${{ steps.changelog.outputs.version }}
path: |
**/*.deb
**/*.changes
**/*.buildinfo
30 changes: 30 additions & 0 deletions .github/actions/get-deb-version/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: "Get Debian Package Version"
description: "Parse Debian version from a debian/changelog file"

inputs:
path:
description: "Path to the folder containing debian/changelog"
required: false
default: '.'

outputs:
version:
description: "Version extracted from debian/changelog"
value: ${{ steps.parse.outputs.version }}

runs:
using: "composite"
steps:
- name: Parse Debian version
id: parse
shell: bash
working-directory: ${{ inputs.path }}
run: |
set -e
if [ ! -f debian/changelog ]; then
echo "error debian/changelog not found"
exit 1
fi
VERSION=$(dpkg-parsechangelog --show-field Version)
echo "Detected version: $VERSION"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
60 changes: 60 additions & 0 deletions .github/actions/trigger-and-wait-build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: "Trigger and Wait for CI Build"
description: "Triggers another workflow and waits until it completes successfully."
author: "Thomas Willetal"

inputs:
workflow:
description: "Name or ID of the workflow to trigger"
required: true
ref:
description: "Git ref or branch to trigger the workflow on"
required: true
default: ${{ github.ref_name }}
poll_interval:
description: "Seconds between status checks"
required: false
default: "30"
token:
description: "GitHub token or PAT for workflow dispatch"
required: true

runs:
using: "composite"
steps:
- name: Install GitHub CLI
shell: bash
run: |
sudo apt-get update -y
sudo apt-get install -y gh jq

- name: Trigger workflow and wait for completion
shell: bash
env:
GITHUB_TOKEN: ${{ inputs.token }}
INPUT_WORKFLOW: ${{ inputs.workflow }}
INPUT_REF: ${{ inputs.ref }}
INPUT_POLL_INTERVAL: ${{ inputs.poll_interval }}
run: |
echo "Triggering workflow '$INPUT_WORKFLOW' on ref '$INPUT_REF'..."
gh workflow run "$INPUT_WORKFLOW" --ref "$INPUT_REF"

echo "Waiting for the workflow to start..."
sleep 10

echo "Polling workflow status every $INPUT_POLL_INTERVAL seconds..."
while true; do
STATUS=$(gh run list --workflow "$INPUT_WORKFLOW" --branch "$INPUT_REF" --limit 1 --json status,conclusion -q '.[0].status')
CONCLUSION=$(gh run list --workflow "$INPUT_WORKFLOW" --branch "$INPUT_REF" --limit 1 --json status,conclusion -q '.[0].conclusion')
echo "Current status: $STATUS / $CONCLUSION"

if [[ "$STATUS" == "completed" ]]; then
if [[ "$CONCLUSION" == "success" ]]; then
echo "Workflow succeeded"
exit 0
else
echo "Workflow failed: $CONCLUSION"
exit 1
fi
fi
sleep "$INPUT_POLL_INTERVAL"
done
52 changes: 16 additions & 36 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name: Podman Compose Build
name: ci-build

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:

jobs:
build:
Expand All @@ -14,39 +15,18 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Podman
run: |
sudo apt-get update
sudo apt-get install -y podman python3-pip

- name: Install podman-compose from PyPI
run: |
pip install --upgrade pip
pip install podman-compose

- name: Verify installation
run: |
podman --version
podman-compose version

- name: Make builder
run: |
make builder

- name: amd64 debbuild
run: |
make amd64-debbuild

- name: arm64 debbuild
run: |
make arm64-debbuild

- name: Upload build artifacts
if: success()
uses: actions/upload-artifact@v4
- name: Build Debian packages
uses: ./.github/actions/build-deb
with:
name: debian-packages
path: |
**/*.deb
**/*.changes
**/*.buildinfo
path: "uds-daemon-example"

- name: Get Debian version
id: changelog
uses: ./.github/actions/get-deb-version
with:
path: "uds-daemon-example"

- name: Show parsed version
run: echo Version=${{ steps.changelog.outputs.version }}


44 changes: 44 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Release

on:
workflow_dispatch:

jobs:
release:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Run Debian build
id: builddeb
uses: ./.github/actions/build-deb
with:
path: "uds-daemon-example"

- name: Show Debian version
run: echo "Built version is ${{ steps.builddeb.outputs.version }}"

- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: uds-daemon-example-${{ steps.builddeb.outputs.version }}
path: ./release-artifacts

- name: Show downloaded files
run: ls -l release-artifacts

- name: Create GitHub Release
if: github.ref == 'refs/heads/main'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION="${{ steps.builddeb.outputs.version }}"
TAG="v${VERSION}"
gh release create "${TAG}" \
--title "Release ${TAG}" \
--notes "Automated release for version ${TAG}" \
./release-artifacts/*


2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
*.deb
*.changes
*.log
!.github/workflows/*.yml
!.github