Skip to content

Usenet streaming with a WebDAV server and a SABnzbd-compatible API

C#

Added automatic versioning to workflow.

nzbdav-devf4b066443215
diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml
index 14e3dda6..e27c4128 100644
--- a/.github/workflows/docker-publish.yml
+++ b/.github/workflows/docker-publish.yml
@@ -31,13 +31,15 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- - name: Set tag name
- id: set_tag
+ - name: Set tag name and branch argument
+ id: set_vars
run: |
if [[ "${{ github.ref_name }}" == "main" ]]; then
echo "TAG=pre-alpha" >> $GITHUB_OUTPUT
+ echo "BRANCH_ARG=" >> $GITHUB_OUTPUT
else
echo "TAG=${{ github.ref_name }}" >> $GITHUB_OUTPUT
+ echo "BRANCH_ARG=${{ github.ref_name }}-" >> $GITHUB_OUTPUT
fi
- name: Build and push Docker image (amd64 + arm64)
@@ -46,4 +48,7 @@ jobs:
context: .
push: true
platforms: linux/amd64,linux/arm64
- tags: ghcr.io/${{ github.repository }}:${{ steps.set_tag.outputs.TAG }}
\ No newline at end of file
+ tags: ghcr.io/${{ github.repository }}:${{ steps.set_vars.outputs.TAG }}
+ build-args: |
+ NZBDAV_BRANCH=${{ steps.set_vars.outputs.BRANCH_ARG }}
+ NZBDAV_PATCH=${{ github.run_number }}
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
index 8b1fbe4a..1cd4bdb8 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -45,6 +45,9 @@ COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
EXPOSE 3000
+ARG NZBDAV_BRANCH=dev-
+ARG NZBDAV_PATCH=x
+ENV NZBDAV_VERSION=${NZBDAV_BRANCH}0.2.${NZBDAV_PATCH}
ENV NODE_ENV=production
ENV LOG_LEVEL=warning
diff --git a/frontend/app/root.tsx b/frontend/app/root.tsx
index 58f93241..50da36db 100644
--- a/frontend/app/root.tsx
+++ b/frontend/app/root.tsx
@@ -28,7 +28,10 @@ export async function loader({ request }: Route.LoaderArgs) {
let session = await sessionStorage.getSession(request.headers.get("cookie"));
let user = session.get("user");
if (!user) return redirect("/login");
- return { useLayout: true };
+ return {
+ useLayout: true,
+ version: process.env.NZBDAV_VERSION
+ };
}
@@ -52,7 +55,7 @@ export function Layout({ children }: { children: React.ReactNode }) {
}
export default function App({ loaderData }: Route.ComponentProps) {
- const { useLayout } = loaderData;
+ const { useLayout, version } = loaderData;
const location = useLocation();
const navigation = useNavigation();
const isNavigating = Boolean(navigation.location);
@@ -68,7 +71,7 @@ export default function App({ loaderData }: Route.ComponentProps) {
<PageLayout
topNavComponent={TopNavigation}
bodyChild={showLoading ? <Loading /> : <Outlet />}
- leftNavChild={<LeftNavigation />} />
+ leftNavChild={<LeftNavigation version={version} />} />
);
}
diff --git a/frontend/app/routes/_index/components/left-navigation/left-navigation.tsx b/frontend/app/routes/_index/components/left-navigation/left-navigation.tsx
index 7eb7212c..df33de31 100644
--- a/frontend/app/routes/_index/components/left-navigation/left-navigation.tsx
+++ b/frontend/app/routes/_index/components/left-navigation/left-navigation.tsx
@@ -4,7 +4,11 @@ import { className } from "~/utils/styling";
import type React from "react";
import { LiveUsenetConnections } from "../live-usenet-connections/live-usenet-connections";
-export function LeftNavigation() {
+export type LeftNavigationProps = {
+ version?: string
+}
+
+export function LeftNavigation({ version }: LeftNavigationProps) {
return (
<div className={styles.container}>
<Item target="/queue">
@@ -32,7 +36,7 @@ export function LeftNavigation() {
changelog
</div>
<div className={styles["footer-item"]}>
- version: 0.2.0
+ version: {version || 'unknown'}
</div>
<hr />
<Form method="post" action="/logout">