From 90771b85e9e91d52d4ce7faf89cf974e549a3b8f Mon Sep 17 00:00:00 2001 From: Arif Hasanic Date: Sun, 31 Aug 2025 16:58:19 +0200 Subject: [PATCH 1/6] write git sha env variable into docker container --- .github/workflows/ci.yml | 4 ++-- nginx.conf | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 31fd769..9c69dd1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,8 +18,8 @@ jobs: run: bun install - name: Build run: bun run build - - name: Write git hash into dist - run: echo "export const GIT_HASH = '$(git rev-parse HEAD)';" > dist/git-hash.js + - name: Write GITHUB_SHA into dist + run: echo "export const GITHUB_SHA = '$GITHUB_SHA';" > dist/git-hash.js - name: Create Build Artifact uses: christopherhx/gitea-upload-artifact@v4 with: diff --git a/nginx.conf b/nginx.conf index a7fecc1..7e9c8a0 100644 --- a/nginx.conf +++ b/nginx.conf @@ -16,7 +16,7 @@ http { index index.html; location / { - try_files $uri $uri/ /index.html; + try_files $uri $uri/ /index.html /git-hash.js; } location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ { -- 2.49.1 From 7912f59fb8da2e41b47dc5ec8a590fbda53194ae Mon Sep 17 00:00:00 2001 From: Arif Hasanic Date: Sun, 31 Aug 2025 17:01:10 +0200 Subject: [PATCH 2/6] ensure git-hash.js is in dist folder --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9c69dd1..a1352bc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,9 +17,9 @@ jobs: - name: Install dependencies run: bun install - name: Build - run: bun run build - - name: Write GITHUB_SHA into dist - run: echo "export const GITHUB_SHA = '$GITHUB_SHA';" > dist/git-hash.js + run: | + bun run build + echo "export const GITHUB_SHA = '$GITHUB_SHA';" > dist/git-hash.js - name: Create Build Artifact uses: christopherhx/gitea-upload-artifact@v4 with: -- 2.49.1 From 46d9b8df94df6656eaf338a383a0e866f086b0b6 Mon Sep 17 00:00:00 2001 From: Arif Hasanic Date: Sun, 31 Aug 2025 17:05:20 +0200 Subject: [PATCH 3/6] docker image now uses dist folder from build step for deploy --- Dockerfile | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2185613..7837ff8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,5 @@ -FROM oven/bun as builder -WORKDIR /app -COPY . . -RUN bun install -RUN bun run build - FROM nginx:alpine -COPY --from=builder /app/dist /usr/share/nginx/html +COPY ./dist /usr/share/nginx/html COPY nginx.conf /etc/nginx/nginx.conf EXPOSE 80 CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file -- 2.49.1 From 59001d5e97efb8ef846409b87c2824a0866f13d9 Mon Sep 17 00:00:00 2001 From: Arif Hasanic Date: Sun, 31 Aug 2025 17:10:57 +0200 Subject: [PATCH 4/6] create git hash html --- .github/workflows/ci.yml | 6 +++--- pipeline/build-image.sh | 1 - pipeline/create-git-hash-html.sh | 13 +++++++++++++ 3 files changed, 16 insertions(+), 4 deletions(-) delete mode 100755 pipeline/build-image.sh create mode 100644 pipeline/create-git-hash-html.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a1352bc..2991939 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,9 +17,9 @@ jobs: - name: Install dependencies run: bun install - name: Build - run: | - bun run build - echo "export const GITHUB_SHA = '$GITHUB_SHA';" > dist/git-hash.js + run: bun run build + - name: Write Git-Hash into html + run: ./pipeline/create-git-hash-html.sh - name: Create Build Artifact uses: christopherhx/gitea-upload-artifact@v4 with: diff --git a/pipeline/build-image.sh b/pipeline/build-image.sh deleted file mode 100755 index cc1f786..0000000 --- a/pipeline/build-image.sh +++ /dev/null @@ -1 +0,0 @@ -#!/bin/bash \ No newline at end of file diff --git a/pipeline/create-git-hash-html.sh b/pipeline/create-git-hash-html.sh new file mode 100644 index 0000000..7af279f --- /dev/null +++ b/pipeline/create-git-hash-html.sh @@ -0,0 +1,13 @@ +#!/bin/sh + + +# create git-hash.html +echo " + + + Git Hash + + +
GITHUB_SHA = '$GITHUB_SHA';
+ +" > dist/git-hash.html \ No newline at end of file -- 2.49.1 From 1100be75c5e755e691339dd62cfb9558dc7b2f2a Mon Sep 17 00:00:00 2001 From: Arif Hasanic Date: Sun, 31 Aug 2025 17:11:21 +0200 Subject: [PATCH 5/6] correct permission on shell script --- pipeline/create-git-hash-html.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 pipeline/create-git-hash-html.sh diff --git a/pipeline/create-git-hash-html.sh b/pipeline/create-git-hash-html.sh old mode 100644 new mode 100755 -- 2.49.1 From 90d32e29f4b2a3f1ead887d6abaf133f78bdce71 Mon Sep 17 00:00:00 2001 From: Arif Hasanic Date: Sun, 31 Aug 2025 18:14:50 +0200 Subject: [PATCH 6/6] add githooks and setup.sh --- .github/workflows/ci.yml | 3 --- githooks/pre-commit | 12 ++++++++++++ pipeline/create-git-hash-html.sh | 2 -- setup.sh | 3 +++ 4 files changed, 15 insertions(+), 5 deletions(-) create mode 100755 githooks/pre-commit create mode 100755 setup.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2991939..284c28f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,7 +60,6 @@ jobs: run: docker build -t git.rivercry.com/wg/monitor-im-flur . - name: Push Docker image run: docker push git.rivercry.com/wg/monitor-im-flur - - name: Deploy via SSH uses: appleboy/ssh-action@v0.1.10 with: @@ -70,8 +69,6 @@ jobs: password: ${{ secrets.GARRISON_DOCKER_PASSWORD }} script: | cd monitor-im-flur - echo "Deploying Docker container..." - $HYPRLAND_INSTANCE_SIGNATURE hyprctl dispatch exec 'pkill firefox' hyprctl dispatch exec 'firefox -kiosk localhost:9123' git clean -dfx diff --git a/githooks/pre-commit b/githooks/pre-commit new file mode 100755 index 0000000..3849097 --- /dev/null +++ b/githooks/pre-commit @@ -0,0 +1,12 @@ +#!/bin/sh + +echo "Running pre-commit hooks..." + +biome check --write +biome lint --write + +if git diff --quiet; then + exit 0 +else + git add -u +fi diff --git a/pipeline/create-git-hash-html.sh b/pipeline/create-git-hash-html.sh index 7af279f..3eb1d94 100755 --- a/pipeline/create-git-hash-html.sh +++ b/pipeline/create-git-hash-html.sh @@ -1,7 +1,5 @@ #!/bin/sh - -# create git-hash.html echo " diff --git a/setup.sh b/setup.sh new file mode 100755 index 0000000..0ba2c34 --- /dev/null +++ b/setup.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +git config --local core.hooksPath githooks -- 2.49.1