Initial commit of addlatest, workflow and configuration.

pull/1/head
Tommie Gannert 2021-09-11 11:37:29 +02:00
commit 29272e175d
6 changed files with 98 additions and 0 deletions

40
.github/workflows/main.yml vendored Normal file
View File

@ -0,0 +1,40 @@
# This is a basic workflow to help you get started with Actions
name: Update Repository
# Controls when the workflow will run
on:
#push:
# # If the configuration has changed, this ensures we apply updates.
# branches: [ main ]
#schedule:
# # Upstream releases around once per month, so twice a week should be fine.
# - cron: '23 14 * * mon,thu'
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends --yes gpg jq reprepro
- name: Checkout
uses: actions/checkout@v2
with:
# See https://github.com/marketplace/actions/github-push
persist-credentials: false
fetch-depth: 0
- name: Download and include package files
run: ./addlatest
- name: Push changes
uses: ad-m/github-push-action@v0.6.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/tmp.addlatest.*

45
addlatest Executable file
View File

@ -0,0 +1,45 @@
#!/bin/bash
#
# Downloads upstream releases and uses reprepro to update the
# repository in debian/. This is idempotent and doesn't clobber files
# if the latest releases is already included.
#
set -e
release_repo=tonarino/innernet
has_changes() {
git status --porcelain --untracked-files=no | grep -q .
}
main() {
local tmpd
tmpd="$(mktemp -d tmp.addlatest.XXXXXXXXXX)"
(
cd "$tmpd"
wget -Olatest.json \
-H'Accept: application/json' \
"https://api.github.com/repos/$release_repo/releases/latest"
cat latest.json \
| jq -r '.assets[] | select(.name | endswith(".deb")) | (.name + " " + .url)' \
| while read name url; do
wget --header='Accept: application/octet-stream' -O"$name" "$url"
reprepro -b ../debian includedeb unstable "$name"
done
if has_changes; then
git \
-c 'user.email=41898282+github-actions[bot]@users.noreply.github.com' \
-c 'user.name=github-actions[bot]' \
commit -m "Included release $release_repo@$(cat latest.json | jq -r '.name | ltrimstr("v")')." debian/{db,dists,pool}
else
echo 'No updates to commit.'
fi
)
}
main

2
debian/conf/deboverride vendored Normal file
View File

@ -0,0 +1,2 @@
innernet-server Source innernet
innernet* $Component contrib

8
debian/conf/distributions vendored Normal file
View File

@ -0,0 +1,8 @@
Origin: Unofficial Innernet Debian repository
Label: innernet-debian
Description: APT repository for https://github.com/tonarino/innernet/.
Codename: bullseye
Suite: unstable
Architectures: amd64
Components: contrib
DebOverride: deboverride

2
debian/conf/options vendored Normal file
View File

@ -0,0 +1,2 @@
verbose
ask-passphrase