Add versioning, release workflow and changelog
Build and deploy / build (push) Successful in 1m56s
Build and deploy / deploy (push) Successful in 22s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
TomandClaude Opus 5.5 committed 2026-11-14 17:25:11 +01:00
1 parent c22d452720
commit 7c3657d015
11 files changed
+222 -11

No files matched your search

+7 -4
View File
@@ -1,6 +1,7 @@
# Builds the image on every push to main, pushes it to the Gitea registry (tagged # Builds the image on every push to main, pushes it to the Gitea registry (tagged
# :latest AND the short commit SHA, for rollback) and deploys the stack on Unraid # :main AND the short commit SHA, for rollback) and deploys the stack on Unraid
# from deploy/unraid/compose.yaml (Tom's personal Unraid setup). # from deploy/unraid/compose.yaml (Tom's personal Unraid setup). Releases (:latest,
# :X.Y.Z) come from version tags in release.yml and are never deployed here.
# #
# The deploy works because the act_runner runs ON Unraid and hands its Docker # The deploy works because the act_runner runs ON Unraid and hands its Docker
# socket to the job: every `docker` command here talks to the Unraid daemon, so # socket to the job: every `docker` command here talks to the Unraid daemon, so
@@ -58,13 +59,15 @@ jobs:
id: sha id: sha
run: echo "short=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" run: echo "short=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
- name: Build and push (:latest and :<sha>) - name: Build and push (:main and :<sha>)
uses: docker/build-push-action@v6 uses: docker/build-push-action@v6
with: with:
context: . context: .
push: true push: true
build-args: |
VERSION=0.0.0-dev+${{ steps.sha.outputs.short }}
tags: | tags: |
${{ env.IMAGE }}:latest ${{ env.IMAGE }}:main
${{ env.IMAGE }}:${{ steps.sha.outputs.short }} ${{ env.IMAGE }}:${{ steps.sha.outputs.short }}
deploy: deploy:
+110
View File
@@ -0,0 +1,110 @@
# Builds a release when a version tag (vX.Y.Z) is pushed: the image is tagged
# :X.Y.Z, :X.Y, :X and :latest in the Gitea registry, and a Gitea release is
# created with the matching section of CHANGELOG.md as notes. Nothing is
# deployed; Tom's Unraid follows :main through deploy.yml.
#
# A pre-release tag such as v0.2.0-rc.1 only gets its own :0.2.0-rc.1 tag and a
# release marked as pre-release; :latest and the short tags stay on the last
# stable version.
#
# Required repository secrets: REGISTRY_USER, REGISTRY_TOKEN (see deploy.yml).
# The release itself uses the job's built-in token.
name: Release
on:
push:
tags: ["v*"]
env:
IMAGE: gitea.anticarnist.de/tom/flypaper
jobs:
image:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
prerelease: ${{ steps.version.outputs.prerelease }}
steps:
- name: Check out the source
uses: actions/checkout@v4
- name: Read the version from the tag
id: version
run: |
version="${GITHUB_REF_NAME#v}"
if ! echo "$version" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$'; then
echo "Tag $GITHUB_REF_NAME is not vX.Y.Z" >&2
exit 1
fi
echo "version=$version" >> "$GITHUB_OUTPUT"
{
echo "tags<<EOF"
echo "$IMAGE:$version"
case "$version" in
*-*) ;;
*)
echo "$IMAGE:${version%.*}"
echo "$IMAGE:${version%%.*}"
echo "$IMAGE:latest"
;;
esac
echo "EOF"
} >> "$GITHUB_OUTPUT"
case "$version" in
*-*) echo "prerelease=true" >> "$GITHUB_OUTPUT" ;;
*) echo "prerelease=false" >> "$GITHUB_OUTPUT" ;;
esac
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Gitea registry
uses: docker/login-action@v3
with:
registry: gitea.anticarnist.de
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Build and push the release tags
uses: docker/build-push-action@v6
with:
context: .
push: true
build-args: |
VERSION=${{ steps.version.outputs.version }}
tags: ${{ steps.version.outputs.tags }}
release:
needs: image
runs-on: ubuntu-latest
steps:
- name: Check out the source
uses: actions/checkout@v4
# The notes are the CHANGELOG.md section of this version, from its heading
# up to the next one. If the API call fails, the images are still pushed;
# the release can then be created by hand (deploy/unraid/README.md).
- name: Create the Gitea release
env:
VERSION: ${{ needs.image.outputs.version }}
PRERELEASE: ${{ needs.image.outputs.prerelease }}
TOKEN: ${{ github.token }}
API: ${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases
run: |
notes=$(awk -v version="$VERSION" '
/^## \[/ { if (found) exit; if (index($0, "[" version "]")) { found = 1; next } }
/^\[[^]]+\]: / { if (found) exit }
found { print }
' CHANGELOG.md)
[ -n "$notes" ] || notes="See CHANGELOG.md."
jq -n \
--arg tag "$GITHUB_REF_NAME" \
--arg name "Flypaper $VERSION" \
--arg body "$notes" \
--argjson prerelease "$PRERELEASE" \
'{tag_name: $tag, name: $name, body: $body, prerelease: $prerelease}' > release.json
curl -fsS -X POST "$API" \
-H "Authorization: token $TOKEN" \
-H "Content-Type: application/json" \
--data @release.json
+33
View File
@@ -0,0 +1,33 @@
# Changelog
All notable changes to Flypaper are documented in this file. The format follows
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project uses
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
## [0.1.0] - 2026-11-14
First release.
### Added
- HTTP tarpit on its own port (8080): every request is caught and answered with endless,
plausible HTML in random chunks of 1–64 bytes with random pauses of 50 ms–1 s.
- Connection governor with limits overall and per IP and a maximum hold time; requests
without a free slot get a quick 404.
- Optional known hosts that are caught only on configurable trap paths.
- Client IP from `X-Real-IP` / `X-Forwarded-For`, trusting private networks by default.
- One log line per catch and storage in SQLite, enriched with country, city and ASN from the
DB-IP Lite databases (downloaded and refreshed monthly, existing catches backfilled).
- Dashboard on its own port (8081): totals, world map, top countries, providers, IPs and
paths, latest catches with expandable rows.
- Settings page for trap paths, known hosts, limits, retention and the private-network filter,
effective without a restart; deleting private or all catches.
- Admin password set on first visit (stored as a salted hash) and changeable later, or fixed
with `Flypaper__Admin__Password`.
- Daily retention cleanup (90 days by default), `/health` endpoint, Docker image running as
non-root with all data under `/data`.
[Unreleased]: https://gitea.anticarnist.de/Tom/Flypaper/compare/v0.1.0...main
[0.1.0]: https://gitea.anticarnist.de/Tom/Flypaper/releases/tag/v0.1.0
+1
View File
@@ -4,5 +4,6 @@
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Version>0.0.0-dev</Version>
</PropertyGroup> </PropertyGroup>
</Project> </Project>
+2 -1
View File
@@ -10,7 +10,8 @@ COPY src/Flypaper.Web/Flypaper.Web.csproj src/Flypaper.Web/
RUN dotnet restore src/Flypaper.Web/Flypaper.Web.csproj RUN dotnet restore src/Flypaper.Web/Flypaper.Web.csproj
COPY src/ src/ COPY src/ src/
RUN dotnet publish src/Flypaper.Web/Flypaper.Web.csproj -c Release -o /app --no-restore ARG VERSION=0.0.0-dev
RUN dotnet publish src/Flypaper.Web/Flypaper.Web.csproj -c Release -o /app --no-restore -p:Version=$VERSION
FROM mcr.microsoft.com/dotnet/aspnet:10.0 FROM mcr.microsoft.com/dotnet/aspnet:10.0
WORKDIR /app WORKDIR /app
+25
View File
@@ -105,6 +105,31 @@ The files in [`deploy/unraid/`](deploy/unraid) and `.gitea/workflows/deploy.yml`
author's personal deployment (Gitea Actions to Unraid). They are an example only and not author's personal deployment (Gitea Actions to Unraid). They are an example only and not
needed to run Flypaper. needed to run Flypaper.
## Versions and updates
Flypaper follows [Semantic Versioning](https://semver.org); every release is listed in
[CHANGELOG.md](CHANGELOG.md). The running version is shown in the dashboard footer and in the
first log line.
| Image tag | Meaning |
|---|---|
| `:latest` | The newest release. The right choice for most setups. |
| `:X.Y.Z` | A fixed release, e.g. `:0.1.0`. Pin it if you update deliberately. |
| `:X.Y`, `:X` | The newest release of that minor or major line. |
| `:main` | Development build of every commit on `main`. May break. |
There is no public image yet. To build a specific release from source:
```bash
git checkout v0.1.0
docker build --build-arg VERSION=0.1.0 -t flypaper:0.1.0 .
```
To update, pull or rebuild the image and recreate the container
(`docker compose pull && docker compose up -d`). The database is migrated automatically on
start; back up the `/data` volume first. Before 1.0, a minor version may contain breaking
changes, so read the changelog.
## Behind a reverse proxy ## Behind a reverse proxy
Flypaper is meant to sit behind the reverse proxy that already owns ports 80/443. The proxy Flypaper is meant to sit behind the reverse proxy that already owns ports 80/443. The proxy
+24 -4
View File
@@ -5,9 +5,29 @@ describes a generic installation.
Every push to `main` (except docs and `.md` files) runs `.gitea/workflows/deploy.yml` on the Every push to `main` (except docs and `.md` files) runs `.gitea/workflows/deploy.yml` on the
act_runner on Unraid: it builds the image, pushes it to act_runner on Unraid: it builds the image, pushes it to
`gitea.anticarnist.de/tom/flypaper` (`:latest` and `:<short-sha>`), deploys `gitea.anticarnist.de/tom/flypaper` (`:main` and `:<short-sha>`), deploys
`deploy/unraid/compose.yaml` and waits for `/health`. A manual run is possible from the Actions `deploy/unraid/compose.yaml` and waits for `/health`. A manual run is possible from the Actions
tab (`workflow_dispatch`). tab (`workflow_dispatch`). The stack follows `:main`, not the releases.
## Releases
A version tag runs `.gitea/workflows/release.yml`: it builds the image with that version,
pushes `:X.Y.Z`, `:X.Y`, `:X` and `:latest` (a pre-release such as `v0.2.0-rc.1` gets only
its own tag) and creates a Gitea release with the version's section of `CHANGELOG.md` as
notes. Nothing is deployed.
1. Move the entries under `[Unreleased]` in `CHANGELOG.md` into a new version section with
today's date, update the links at the bottom, commit and push.
2. Tag and push:
```bash
git tag -a v0.1.0 -m "Flypaper 0.1.0"
git push origin v0.1.0
```
If the release step fails (e.g. the built-in token may not create releases), the images are
already pushed. Create the release by hand: Gitea → repo → Releases → New Release, pick the
tag, title `Flypaper X.Y.Z`, paste the changelog section.
## Secrets ## Secrets
@@ -41,5 +61,5 @@ deploy.
## Rollback ## Rollback
Pin the image in `compose.yaml` to a previous `:<short-sha>` and push, or deploy that tag Pin the image in `compose.yaml` to a previous `:<short-sha>` or a release `:X.Y.Z` and push,
manually on Unraid. or deploy that tag manually on Unraid.
+2 -1
View File
@@ -14,7 +14,8 @@ name: flypaper
services: services:
flypaper: flypaper:
image: gitea.anticarnist.de/tom/flypaper:latest # :main follows every push to main; releases are tagged :X.Y.Z and :latest.
image: gitea.anticarnist.de/tom/flypaper:main
container_name: flypaper container_name: flypaper
restart: always restart: always
ports: ports:
+15
View File
@@ -0,0 +1,15 @@
using System.Reflection;
namespace Flypaper.Web;
public static class AppVersion
{
public static string Current { get; } = Read();
private static string Read()
{
var version = typeof(AppVersion).Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion ?? "0.0.0-dev";
var plus = version.IndexOf('+');
return plus >= 0 && version.Length > plus + 8 ? version[..(plus + 8)] : version;
}
}
@@ -11,6 +11,6 @@
</nav> </nav>
@Body @Body
<footer class="footer"> <footer class="footer">
<a href="https://db-ip.com">IP Geolocation by DB-IP</a> (CC BY 4.0) · Kartendaten: Natural Earth Flypaper @AppVersion.Current · <a href="https://db-ip.com">IP Geolocation by DB-IP</a> (CC BY 4.0) · Kartendaten: Natural Earth
</footer> </footer>
</main> </main>
+2
View File
@@ -2,6 +2,7 @@ using Flypaper.Core;
using Flypaper.GeoIp; using Flypaper.GeoIp;
using Flypaper.Http; using Flypaper.Http;
using Flypaper.Storage; using Flypaper.Storage;
using Flypaper.Web;
using Flypaper.Web.Auth; using Flypaper.Web.Auth;
using Flypaper.Web.Components; using Flypaper.Web.Components;
using Flypaper.Web.Health; using Flypaper.Web.Health;
@@ -50,6 +51,7 @@ builder.Services.AddAuthorizationBuilder()
var app = builder.Build(); var app = builder.Build();
app.Logger.LogInformation("Flypaper {Version} starting", AppVersion.Current);
await app.Services.MigrateFlypaperDatabaseAsync(); await app.Services.MigrateFlypaperDatabaseAsync();
app.UseFlypaper(); app.UseFlypaper();