Skip to content

Commit cdd9ef7

Browse files
committed
Added automatic versioning to workflow.
1 parent 3c96b5c commit cdd9ef7

File tree

4 files changed

+23
-8
lines changed

4 files changed

+23
-8
lines changed

.github/workflows/docker-publish.yml renamed to .github/workflows/docker-publish-0.2.x.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,15 @@ jobs:
3131
username: ${{ github.actor }}
3232
password: ${{ secrets.GITHUB_TOKEN }}
3333

34-
- name: Set tag name
35-
id: set_tag
34+
- name: Set tag name and branch argument
35+
id: set_vars
3636
run: |
3737
if [[ "${{ github.ref_name }}" == "main" ]]; then
3838
echo "TAG=pre-alpha" >> $GITHUB_OUTPUT
39+
echo "BRANCH_ARG=" >> $GITHUB_OUTPUT
3940
else
4041
echo "TAG=${{ github.ref_name }}" >> $GITHUB_OUTPUT
42+
echo "BRANCH_ARG=${{ github.ref_name }}-" >> $GITHUB_OUTPUT
4143
fi
4244
4345
- name: Build and push Docker image (amd64 + arm64)
@@ -46,4 +48,7 @@ jobs:
4648
context: .
4749
push: true
4850
platforms: linux/amd64,linux/arm64
49-
tags: ghcr.io/${{ github.repository }}:${{ steps.set_tag.outputs.TAG }}
51+
tags: ghcr.io/${{ github.repository }}:${{ steps.set_vars.outputs.TAG }}
52+
build-args: |
53+
NZBDAV_BRANCH=${{ steps.set_vars.outputs.BRANCH_ARG }}
54+
NZBDAV_PATCH=${{ github.run_number }}

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ COPY entrypoint.sh /entrypoint.sh
4545
RUN chmod +x /entrypoint.sh
4646

4747
EXPOSE 3000
48+
ARG NZBDAV_BRANCH=dev-
49+
ARG NZBDAV_PATCH=x
50+
ENV NZBDAV_VERSION=${NZBDAV_BRANCH}0.2.${NZBDAV_PATCH}
4851
ENV NODE_ENV=production
4952
ENV LOG_LEVEL=warning
5053

frontend/app/root.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ export async function loader({ request }: Route.LoaderArgs) {
2828
let session = await sessionStorage.getSession(request.headers.get("cookie"));
2929
let user = session.get("user");
3030
if (!user) return redirect("/login");
31-
return { useLayout: true };
31+
return {
32+
useLayout: true,
33+
version: process.env.NZBDAV_VERSION
34+
};
3235
}
3336

3437

@@ -52,7 +55,7 @@ export function Layout({ children }: { children: React.ReactNode }) {
5255
}
5356

5457
export default function App({ loaderData }: Route.ComponentProps) {
55-
const { useLayout } = loaderData;
58+
const { useLayout, version } = loaderData;
5659
const location = useLocation();
5760
const navigation = useNavigation();
5861
const isNavigating = Boolean(navigation.location);
@@ -68,7 +71,7 @@ export default function App({ loaderData }: Route.ComponentProps) {
6871
<PageLayout
6972
topNavComponent={TopNavigation}
7073
bodyChild={showLoading ? <Loading /> : <Outlet />}
71-
leftNavChild={<LeftNavigation />} />
74+
leftNavChild={<LeftNavigation version={version} />} />
7275
);
7376
}
7477

frontend/app/routes/_index/components/left-navigation/left-navigation.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ import { className } from "~/utils/styling";
44
import type React from "react";
55
import { LiveUsenetConnections } from "../live-usenet-connections/live-usenet-connections";
66

7-
export function LeftNavigation() {
7+
export type LeftNavigationProps = {
8+
version?: string
9+
}
10+
11+
export function LeftNavigation({ version }: LeftNavigationProps) {
812
return (
913
<div className={styles.container}>
1014
<Item target="/queue">
@@ -32,7 +36,7 @@ export function LeftNavigation() {
3236
changelog
3337
</div>
3438
<div className={styles["footer-item"]}>
35-
version: 0.2.0
39+
version: {version || 'unknown'}
3640
</div>
3741
<hr />
3842
<Form method="post" action="/logout">

0 commit comments

Comments
 (0)