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
66 changes: 66 additions & 0 deletions .github/workflows/deploy-to-vm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Created with assistance from GPT-5.6 Terra High

name: CI/CD - Deploy to VM

on:
workflow_run:
workflows: ["CI/CD - Run lint and formatting checkout"]
types: [completed]
branches:
- main

permissions:
contents: read

concurrency:
group: production-deploy
cancel-in-progress: false

jobs:
deploy:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: [self-hosted]
timeout-minutes: 10

env:
SITE_ROOT: /var/www/html/project1
npm_config_cache: ${{ github.workspace }}/.npm-cache
TMPDIR: ${{ github.workspace }}/.tmp

steps:
- name: Check out source
uses: actions/checkout@v4
with:
ref: ${{ github.event.workflow_run.head_sha }}

- name: Install dependencies
working-directory: vær
run: |
mkdir -p "$TMPDIR"
npm ci --no-audit --no-fund
- name: Build app
working-directory: vær
run: npm run build

- name: Deploy app to Apache
run: |
set -euo pipefail
test -d "$SITE_ROOT"
test -f vær/dist/index.html
rsync -a --delete --chmod=D755,F644 \
vær/dist/ "$SITE_ROOT/"
- name: Clean up job files
if: always()
run: |
set -euo pipefail
# Removes the checkout, node_modules, dist, npm cache, and TMPDIR.
# Keeps the runner's own _work directory intact.
if [ -d "$GITHUB_WORKSPACE" ]; then
find "$GITHUB_WORKSPACE" -mindepth 1 -maxdepth 1 \
-exec rm -rf -- {} +
fi
37 changes: 37 additions & 0 deletions .github/workflows/lint-and-format.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: CI/CD - Run lint and formatting checkout

on:
push:
branches:
- main
pull_request:
types:
- opened

jobs:
deploy:
runs-on: [self-hosted]
timeout-minutes: 10

env:
SITE_ROOT: /var/www/html/project1
npm_config_cache: ${{ github.workspace }}/.npm-cache
TMPDIR: ${{ github.workspace }}/.tmp

steps:
- name: Check out source
uses: actions/checkout@v4

- name: Install dependencies
working-directory: vær
run: |
mkdir -p "$TMPDIR"
npm ci --no-audit --no-fund
- name: Run Prettier check
working-directory: vær
run: npx exec prettier . --check

- name: Run ESLint
working-directory: vær
run: npm run lint
21 changes: 0 additions & 21 deletions node_modules/.bin/prettier

This file was deleted.

23 changes: 0 additions & 23 deletions node_modules/.package-lock.json

This file was deleted.

28 changes: 0 additions & 28 deletions package-lock.json

This file was deleted.

5 changes: 0 additions & 5 deletions package.json

This file was deleted.

7 changes: 5 additions & 2 deletions vær/.prettierrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{

}
"trailingComma": "es5",
"tabWidth": 2,
"semi": false,
"singleQuote": false
}
17 changes: 17 additions & 0 deletions vær/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions vær/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"eslint-plugin-react-hooks": "^7.1.1",
"eslint-plugin-react-refresh": "^0.5.6",
"globals": "^17.12.0",
"prettier": "^3.9.7",
"typescript": "~6.0.2",
"typescript-eslint": "^8.69.0",
"vite": "^8.3.0"
Expand Down
2 changes: 1 addition & 1 deletion vær/src/hooks/useStorage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState, useEffect, useCallback } from "react";
import { useState, useCallback } from "react";
import { getData, saveData } from "../services/storage";
import type {AppStorage} from "../services/storage";

Expand Down
1 change: 1 addition & 0 deletions vær/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ import { defineConfig } from 'vite'
// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
base: "/project1",
})