mirror of
https://github.com/fosrl/newt.git
synced 2026-03-26 20:46:41 +00:00
Refactor package build process in publish-apt.yml
Refactor nfpm.yaml generation to use Python script and update package naming conventions.
This commit is contained in:
51
.github/workflows/publish-apt.yml
vendored
51
.github/workflows/publish-apt.yml
vendored
@@ -94,7 +94,7 @@ jobs:
|
|||||||
PREFIX="${{ vars.S3_PREFIX }}"
|
PREFIX="${{ vars.S3_PREFIX }}"
|
||||||
aws s3 sync "s3://${BUCKET}/${PREFIX}apt/" repo/apt/ || true
|
aws s3 sync "s3://${BUCKET}/${PREFIX}apt/" repo/apt/ || true
|
||||||
|
|
||||||
- name: Build packages and update repo (for selected tags)
|
- name: Build packages and update repo (for selected tags)
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
REPO: ${{ github.repository }}
|
REPO: ${{ github.repository }}
|
||||||
@@ -108,7 +108,6 @@ jobs:
|
|||||||
|
|
||||||
mkdir -p assets build
|
mkdir -p assets build
|
||||||
|
|
||||||
# Iterate over tags safely (no bash <<< with GH expressions)
|
|
||||||
printf '%s\n' "${TAGS}" | while IFS= read -r TAG; do
|
printf '%s\n' "${TAGS}" | while IFS= read -r TAG; do
|
||||||
[ -z "${TAG}" ] && continue
|
[ -z "${TAG}" ] && continue
|
||||||
echo "=== Processing tag: ${TAG} ==="
|
echo "=== Processing tag: ${TAG} ==="
|
||||||
@@ -126,37 +125,29 @@ jobs:
|
|||||||
test -f "${bin}"
|
test -f "${bin}"
|
||||||
install -Dm755 "${bin}" "build/newt"
|
install -Dm755 "${bin}" "build/newt"
|
||||||
|
|
||||||
cat > nfpm.yaml <<'EOF'
|
python3 - <<PY
|
||||||
name: newt
|
import yaml
|
||||||
arch: ARCH_PLACEHOLDER
|
cfg = {
|
||||||
platform: linux
|
"name": "newt",
|
||||||
version: VERSION_PLACEHOLDER
|
"arch": "${arch}",
|
||||||
section: net
|
"platform": "linux",
|
||||||
priority: optional
|
"version": "${VERSION}",
|
||||||
maintainer: fosrl
|
"section": "net",
|
||||||
description: Newt - userspace tunnel client and TCP/UDP proxy
|
"priority": "optional",
|
||||||
contents:
|
"maintainer": "fosrl",
|
||||||
- src: build/newt
|
"description": "Newt - userspace tunnel client and TCP/UDP proxy",
|
||||||
dst: /usr/bin/newt
|
"contents": [
|
||||||
EOF
|
{"src": "build/newt", "dst": "/usr/bin/newt"}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
print(yaml.safe_dump(cfg, sort_keys=False))
|
||||||
|
PY > nfpm.yaml
|
||||||
|
|
||||||
# Replace placeholders (avoid YAML/heredoc expression issues)
|
nfpm package -p deb -f nfpm.yaml -t "build/newt_${VERSION}_${arch}.deb"
|
||||||
sed -i "s/ARCH_PLACEHOLDER/${arch}/" nfpm.yaml
|
|
||||||
sed -i "s/VERSION_PLACEHOLDER/${VERSION}/" nfpm.yaml
|
|
||||||
|
|
||||||
nfpm package -p deb -f nfpm.yaml -t "build/${PKG_NAME}_${VERSION}_${arch}.deb"
|
|
||||||
done
|
done
|
||||||
|
|
||||||
mkdir -p "repo/apt/pool/${COMPONENT}/${PKG_NAME:0:1}/${PKG_NAME}/"
|
mkdir -p "repo/apt/pool/main/n/newt/"
|
||||||
cp -v build/*.deb "repo/apt/pool/${COMPONENT}/${PKG_NAME:0:1}/${PKG_NAME}/"
|
cp -v build/*.deb "repo/apt/pool/main/n/newt/"
|
||||||
done
|
|
||||||
|
|
||||||
cd repo/apt
|
|
||||||
|
|
||||||
for arch in amd64 arm64; do
|
|
||||||
mkdir -p "dists/${SUITE}/${COMPONENT}/binary-${arch}"
|
|
||||||
dpkg-scanpackages -a "${arch}" pool > "dists/${SUITE}/${COMPONENT}/binary-${arch}/Packages"
|
|
||||||
gzip -fk "dists/${SUITE}/${COMPONENT}/binary-${arch}/Packages"
|
|
||||||
done
|
done
|
||||||
|
|
||||||
cat > apt-ftparchive.conf <<EOF
|
cat > apt-ftparchive.conf <<EOF
|
||||||
|
|||||||
Reference in New Issue
Block a user