Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ jobs:
permissions:
contents: read
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7

- uses: actions/setup-go@v6
- uses: actions/setup-go@v7
with:
go-version-file: go.mod
cache: false
Expand Down Expand Up @@ -64,7 +64,7 @@ jobs:
permissions:
contents: read
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7

- name: Set up QEMU
uses: docker/setup-qemu-action@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ jobs:
permissions:
contents: read
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7

- uses: actions/setup-go@v6
- uses: actions/setup-go@v7
with:
go-version-file: go.mod
cache: false
Expand Down
27 changes: 24 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:

env:
REGISTRY: ghcr.io
UPSTREAM_REPOSITORY: TypeType-Video/TypeType
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true

concurrency:
Expand All @@ -30,18 +31,37 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v6
uses: actions/checkout@v7

- name: Isolate Docker credentials
run: echo "DOCKER_CONFIG=$RUNNER_TEMP/docker-config" >> "$GITHUB_ENV"

- name: Resolve build metadata
id: build-info
env:
GH_TOKEN: ${{ github.token }}
run: |
base_version="0.1.0"
if [[ "$GITHUB_REF" == refs/tags/v* ]]; then
version="${GITHUB_REF_NAME#v}"
base_version="${GITHUB_REF_NAME#v}"
if [[ ! "$base_version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Invalid component release tag: $GITHUB_REF_NAME"
exit 1
fi
gh api "repos/${UPSTREAM_REPOSITORY}/git/ref/tags/v${base_version}" >/dev/null
version="$base_version"
else
upstream_tag="$(gh api "repos/${UPSTREAM_REPOSITORY}/releases/latest" --jq '.tag_name')"
if [[ ! "$upstream_tag" =~ ^v([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
echo "Invalid upstream TypeType release tag: $upstream_tag"
exit 1
fi
base_version="${BASH_REMATCH[1]}"
fi
if [[ "$GITHUB_REF_NAME" == "main" ]]; then
version="$base_version"
elif [[ "$GITHUB_REF_NAME" == "dev" ]]; then
version="$base_version-dev.$GITHUB_RUN_NUMBER"
elif [[ "$GITHUB_REF" != refs/tags/v* ]]; then
channel="${GITHUB_REF_NAME//[^0-9A-Za-z-]/-}"
version="$base_version-$channel.$GITHUB_RUN_NUMBER"
fi
Expand Down Expand Up @@ -69,6 +89,7 @@ jobs:
with:
images: ${{ steps.build-info.outputs.image }}
tags: |
type=raw,value=${{ steps.build-info.outputs.version }}
type=sha,prefix=sha-,format=short
type=ref,event=branch
type=ref,event=tag
Expand Down
16 changes: 6 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
FROM golang:1.26-trixie AS build
FROM golang:1.26-alpine3.23 AS build

ARG BUILD_VERSION=0.1.0
ARG BUILD_VERSION=1.2.4-dev
ARG BUILD_REVISION=development
ARG BUILD_TIME=unknown
WORKDIR /src
RUN apt-get update \
&& apt-get install -y --no-install-recommends pkg-config libavformat-dev libavcodec-dev libavutil-dev \
&& rm -rf /var/lib/apt/lists/*
RUN apk add --no-cache build-base pkgconf ffmpeg-dev

COPY go.mod go.sum ./
RUN go mod download

COPY . .
RUN CGO_ENABLED=1 go build -trimpath -ldflags="-s -w -X typetype-downloader-go/internal/buildinfo.Version=$BUILD_VERSION -X typetype-downloader-go/internal/buildinfo.Revision=$BUILD_REVISION -X typetype-downloader-go/internal/buildinfo.BuildTime=$BUILD_TIME" -o /out/typetype-downloader-go ./cmd/server

FROM debian:trixie-slim
FROM alpine:3.23

RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates ffmpeg libavformat61 libavcodec61 libavutil59 \
&& rm -rf /var/lib/apt/lists/*
RUN apk add --no-cache ca-certificates ffmpeg

RUN useradd --system --create-home --home-dir /app typetype
RUN addgroup -S typetype && adduser -S -G typetype -h /app typetype
WORKDIR /app
COPY --from=build /out/typetype-downloader-go /usr/local/bin/typetype-downloader-go
RUN mkdir -p /app/data && chown -R typetype:typetype /app
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.wolfi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM cgr.dev/chainguard/go:latest-dev AS build

ARG BUILD_VERSION=0.1.0
ARG BUILD_VERSION=1.2.4-dev
ARG BUILD_REVISION=development
ARG BUILD_TIME=unknown
USER root
Expand Down
2 changes: 1 addition & 1 deletion cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ func main() {
store := job.NewStore(cfg.PublicBaseURL, sinks...)
store.Restore(restored)
pendingIDs := store.RestorePending(pending)
runner := pipeline.NewRunner(cfg, store, files)
disk, err := storage.NewMonitor(cfg.DataDir, cfg.MinFreeBytes, cfg.MinFreePercent)
if err != nil {
slog.Error("storage monitor failed", "error", err)
os.Exit(1)
}
runner := pipeline.NewRunner(cfg, store, files, disk)
runner.Start(ctx)
cleanup.Start(ctx, cfg.DataDir, cfg.StorageBackend)
for _, id := range pendingIDs {
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ services:
retries: 30

dragonfly:
image: docker.dragonflydb.io/dragonflydb/dragonfly:v1.38.0
image: docker.dragonflydb.io/dragonflydb/dragonfly:v1.39.0
ports:
- "56379:6379"

Expand Down
4 changes: 3 additions & 1 deletion internal/api/version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ func TestVersionReturnsBuildMetadata(t *testing.T) {
if err := json.Unmarshal(response.Body.Bytes(), &body); err != nil {
t.Fatal(err)
}
if body["revision"] != buildinfo.Revision || body["service"] != "downloader" {
if body["service"] != "downloader" ||
body["version"] != buildinfo.Version ||
body["revision"] != buildinfo.Revision {
t.Fatalf("body = %#v", body)
}
}
2 changes: 1 addition & 1 deletion internal/buildinfo/info.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package buildinfo

var Version = "0.1.0"
var Version = "1.2.4-dev"
var Revision = "development"
var BuildTime = "unknown"

Expand Down
Loading