diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c63559c..9f083b1 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 Git-Hash into html + run: ./pipeline/create-git-hash-html.sh - name: Create Build Artifact uses: christopherhx/gitea-upload-artifact@v4 with: @@ -42,7 +42,7 @@ jobs: run: biome ci . create-and-publish-docker-image: - needs: [build] + needs: [lint] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -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: 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 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/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)$ { 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 100755 index 0000000..3eb1d94 --- /dev/null +++ b/pipeline/create-git-hash-html.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +echo " + + + Git Hash + + +
GITHUB_SHA = '$GITHUB_SHA';
+ +" > dist/git-hash.html \ No newline at end of file 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