Skip to content

Commit

Permalink
Packages repository for Ubuntu
Browse files Browse the repository at this point in the history
  • Loading branch information
kiron1 committed Dec 16, 2023
0 parents commit 79de70a
Show file tree
Hide file tree
Showing 7 changed files with 138 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---

name: main

on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:

jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Build
run: ./apt.sh
- name: Upload Pages Artifact
uses: actions/upload-pages-artifact@v2
with:
path: "public"

# Deploy job
deploy:
needs: build

# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write
id-token: write

# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v3
28 changes: 28 additions & 0 deletions apt-ftparchive.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Dir {
ArchiveDir "./public/ubuntu";
CacheDir "./cache";
};
Default {
Packages::Extensions ".deb";
Packages::Compress ". gzip bzip2";
Sources::Compress ". gzip bzip2";
Contents::Compress "gzip bzip2";
};

TreeDefault {
BinCacheDB "packages-$(SECTION)-$(ARCH).db";
Packages "$(DIST)/$(SECTION)/binary-$(ARCH)/Packages";
SrcDirectory "pool/$(SECTION)";
Sources "$(DIST)/$(SECTION)/source/Sources";
Contents "$(DIST)/Contents-$(ARCH)";
};
Tree "dists/focal" {
Sections "main";
Directory "pool/focal/$(SECTION)";
Architectures "amd64";
}
Tree "dists/jammy" {
Sections "main";
Directory "pool/jammy/$(SECTION)";
Architectures "amd64";
}
44 changes: 44 additions & 0 deletions apt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env bash
#
# https://unix.stackexchange.com/a/403489
# https://gist.github.com/aarroyoc/1a96b2f8b01fcf34221a
#

set -euo pipefail

# repos=(kiron1/proxydetox kiron1/bazel-compile-commands)
repos=(kiron1/proxydetox)
machines=(x86_64)

declare -A aptarch=( ["x86_64"]="amd64" )

suits=(focal jammy)

eval "$(apt-config -c apt-ftparchive.conf shell archive_dir Dir::ArchiveDir/d)"

mkdir -p "${archive_dir}/pool/main"

for r in "${repos[@]}"; do
tag=$(gh release view -R "${r}" --json tagName --jq '.tagName')
for s in "${suits[@]}"; do
mkdir -p "${archive_dir}/pool/${s}/main"
rm -f -- "${archive_dir}/pool/${s}/main"/*.deb
for m in "${machines[@]}"; do
printf 'Download %s %s\n' "${r}" "${tag}"
gh release download -R "${r}" "${tag}" --dir "${archive_dir}/pool/${s}/main" --pattern "*-${m}-${s}.deb" --skip-existing
done
find "${archive_dir}/pool/${s}/main/" -name '*.deb' -exec dpkg-name {} +
done
done

r=kiron1/bazel-compile-commands
tag=$(gh release view -R "${r}" --json tagName --jq '.tagName')
gh release download -R "${r}" "${tag}" --dir "${archive_dir}/pool/focal/main" --pattern "*.deb" --skip-existing

for s in "${suits[@]}"; do
for m in "${machines[@]}"; do
mkdir -p "${archive_dir}/dists/${s}/main/binary-${aptarch[${m}]}"
done
apt-ftparchive generate apt-ftparchive.conf
apt-ftparchive "-c=${s}.conf" release "${archive_dir}/dists/${s}" > "${archive_dir}/dists/${s}/Release"
done
1 change: 1 addition & 0 deletions cache/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.db
9 changes: 9 additions & 0 deletions focal.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
APT::FTPArchive::Release {
Origin "Your origin";
Label "Your label";
Suite "focal";
Codename "focal";
Architectures "amd64";
Components "main";
Description "color to see see";
};
9 changes: 9 additions & 0 deletions jammy.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
APT::FTPArchive::Release {
Origin "Your origin";
Label "Your label";
Suite "jammy";
Codename "jammy";
Architectures "amd64";
Components "main";
Description "color to see see";
};
1 change: 1 addition & 0 deletions public/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ubuntu/

0 comments on commit 79de70a

Please sign in to comment.