Add debian build and package
This commit is contained in:
84
.gitea/workflows/build-debian.yml
Normal file
84
.gitea/workflows/build-debian.yml
Normal file
@@ -0,0 +1,84 @@
|
||||
name: Build Chrony from Mirror
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: 'The "v" tag to build (e.g., v4.7)'
|
||||
required: true
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
build-and-upload-deb:
|
||||
runs-on: ubuntu-24.04
|
||||
|
||||
steps:
|
||||
- name: Get Build Version
|
||||
run: |
|
||||
if [[ "${{ gitea.event_name }}" == "push" ]]; then
|
||||
TRIGGER_TAG="${{ gitea.ref_name }}"
|
||||
echo "Triggered by tag push: $TRIGGER_TAG"
|
||||
elif [[ "${{ gitea.event_name }}" == "workflow_dispatch" ]]; then
|
||||
TRIGGER_TAG="${{ inputs.tag }}"
|
||||
echo "Triggered by manual dispatch: $TRIGGER_TAG"
|
||||
fi
|
||||
if [ -z "$TRIGGER_TAG" ]; then
|
||||
echo "Error: Could not determine tag name."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# The upstream chrony mirror uses "4.7", but our builder repo uses "v4.7".
|
||||
# We strip the "v" to get the tag name for the mirror.
|
||||
UPSTREAM_TAG=$(echo $TRIGGER_TAG | sed 's/^v//')
|
||||
echo "Builder Tag: $TRIGGER_TAG"
|
||||
echo "Upstream Tag: $UPSTREAM_TAG"
|
||||
|
||||
echo "TRIGGER_TAG=${TRIGGER_TAG}" >> $GITEA_ENV
|
||||
echo "UPSTREAM_TAG=${UPSTREAM_TAG}" >> $GITEA_ENV
|
||||
|
||||
- name: Clone Chrony Source Code
|
||||
run: |
|
||||
git clone https://git.dws.rip/dws/chrony.git
|
||||
cd chrony
|
||||
echo "Checking out upstream tag: ${{ env.UPSTREAM_TAG }}"
|
||||
git checkout ${{ env.UPSTREAM_TAG }}
|
||||
- name: Install Build Dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
cd chrony
|
||||
sudo apt-get install -y dpkg-dev debhelper devscripts build-essential
|
||||
sudo apt-get build-dep -y .
|
||||
|
||||
- name: Import GPG Key
|
||||
uses: https://github.com/crazy-max/ghaction-import-gpg@v6
|
||||
with:
|
||||
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||
passphrase: ${{ secrets.GPG_PASSPHRASE }}
|
||||
git_user_signingkey: true
|
||||
git_committer_name: "DWS Packages"
|
||||
git_committer_email: "packages@dws.rip"
|
||||
|
||||
- name: Build the SIGNED .deb Package
|
||||
run: |
|
||||
cd chrony
|
||||
dpkg-buildpackage --unsigned-source -b
|
||||
- name: Upload to Gitea Debian Registry
|
||||
run: |
|
||||
# --- Set your Gitea variables ---
|
||||
OWNER=dws
|
||||
DEBIAN_DIST=noble
|
||||
DEBIAN_COMP=main
|
||||
# Find the .changes file (it's in the parent dir of chrony-mirror)
|
||||
CHANGES_FILE=$(find . -maxdepth 1 -name "*.changes" | head -n 1)
|
||||
if [ -z "$CHANGES_FILE" ]; then
|
||||
echo "Error: No .changes file found. Build may have failed."
|
||||
exit 1
|
||||
fi
|
||||
echo "Uploading $CHANGES_FILE..."
|
||||
curl -L --fail \
|
||||
-X POST "https://git.dws.rip/api/packages/${OWNER}/debian/upload/${DEBIAN_DIST}/${DEBIAN_COMP}" \
|
||||
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
||||
-F "file=@${CHANGES_FILE}"
|
||||
Reference in New Issue
Block a user