From 70168cef15e7b8cf181e89502e918beaaeed8fb1 Mon Sep 17 00:00:00 2001 From: Deuchnord Date: Thu, 16 Oct 2025 17:02:18 +0200 Subject: [PATCH] Add APT repo --- .editorconfig | 3 ++ .github/workflows/publish.yml | 75 +++++++++++++++++++++++++++++++++++ .gitignore | 2 + Makefile | 38 ++++++++++++++++++ README.md | 26 ++++++++++++ 5 files changed, 144 insertions(+) create mode 100644 .github/workflows/publish.yml create mode 100644 README.md diff --git a/.editorconfig b/.editorconfig index 323a0b3..d314fb3 100644 --- a/.editorconfig +++ b/.editorconfig @@ -17,3 +17,6 @@ max_line_length = 80 [*.md] trim_trailing_whitespace = false + +[*.yml] +indent_size = 2 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..3b3bbbb --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,75 @@ +name: Deploy repositories + +on: + push: + branches: ["main"] + workflow_dispatch: + +jobs: + create-repo: + runs-on: ubuntu-latest + + strategy: + matrix: + repository: + - name: APT + + + name: "Build ${{ matrix.repository.name }}" + + steps: + - uses: actions/checkout@v5 + + - uses: actions/setup-python@v6 + with: + python-version: "3.x" + + - run: | + pip install kosmorro + + - run: | + sudo apt update + sudo apt install ronn dpkg fakeroot aptly + + # Start instructions specific to APT repositories + + - if: ${{ matrix.repository.name }} == "APT" + env: + DEBPKG_PRIVKEY: ${{ secrets.DEBPKG_PRIVKEY }} + run: | + echo "${{ env.DEBPKG_PRIVKEY }}" > key.asc + gpg --import key.asc + rm key.asc + + - if: ${{ matrix.repository.name }} == "APT" + env: + DEBPKG_KEY_ID: ${{ secrets.DEBPKG_KEY_ID }} + run: make repos + + # End instructions specific to APT repositories + + - if: ${{ matrix.repository.name }} != "APT" + run: make repos + + - id: deployment + uses: actions/upload-pages-artifact@v3 + with: + path: repos + + + deploy: + name: "Deploy" + runs-on: ubuntu-latest + needs: create-repo + + permissions: + pages: write + id-token: write + + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + steps: + - id: deployment + uses: actions/deploy-pages@v4 diff --git a/.gitignore b/.gitignore index c00df13..5ddad80 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ *.deb +/repos/ + diff --git a/Makefile b/Makefile index 5e0c704..ed34d60 100644 --- a/Makefile +++ b/Makefile @@ -2,10 +2,25 @@ SKYFIELD_DATA_VERSION ?= $(shell pip show skyfield-data | grep Version | awk '{p KOSMORROLIB_VERSION ?= $(shell pip show kosmorrolib | grep Version | awk '{print $$2}') KOSMORRO_VERSION ?= $(shell pip show kosmorro | grep Version | awk '{print $$2}') +DEBPKG_KEY_ID ?= "" + clean: rm -rf *.deb + aptly publish drop main || true + aptly snapshot drop main || true + aptly repo drop main || true + + rm -rf ~/.aptly/public/ + rm -rf main repos + + +packages: deb + + +repos: packages repo-apt + ####################### ### DEBIAN PACKAGES ### @@ -14,6 +29,29 @@ clean: .PHONY: deb deb: python3-skyfield-data.deb python3-kosmorrolib.deb kosmorro.deb + +repo-apt: + mkdir main && mv *.deb main + aptly repo create main + aptly repo add main main/ + aptly snapshot create main from repo main + mkdir -p ~/.aptly/public + aptly publish snapshot --architectures=all --distribution=main --gpg-key="$(DEBPKG_KEY_ID)" main + + rm -rf repos/apt + + mkdir -p repos + cp -r ~/.aptly/public repos/apt + mv repos/apt/dists/main repos/apt/dists/stable + + # Clean: + aptly publish drop main + aptly snapshot drop main + aptly repo drop main + + rm -rf main + + python3-skyfield-data.deb: mkdir -p skyfield-data-deb/DEBIAN mkdir -p skyfield-data-deb/usr/bin diff --git a/README.md b/README.md new file mode 100644 index 0000000..9496e80 --- /dev/null +++ b/README.md @@ -0,0 +1,26 @@ +# Kosmorro repositories + +This repository contains recipes to build and publish packages and repositories for various Linux distributions. + +It provides the following packages: + +- [`kosmorro`](https://kosmorro.space) +- [`kosmorrolib`](https://kosmorro.space/lib) +- [`skyfield-data`](https://pypi.org/project/skyfield-data) + +## Using the repositories + +See the instructions specific at your distribution on [Kosmorro's website](https://kosmorro.space/cli/download/linux). + +## Build packages + +If you prefer, you can also build the packages by yourselves: + +### DEB (Debian, Ubuntu, Linux Mint) + +First, install the `dpkg-dev` and `fakeroot` packages. +Then, run the following command: + +```bash +make deb +```