Compare commits
16 Commits
051cadca66
...
develop
Author | SHA1 | Date | |
---|---|---|---|
d160e6d1ca | |||
3840766ad5 | |||
e06ef027fd | |||
e5a95e0c97 | |||
c9cb20cd38 | |||
a77266b683 | |||
15440bb912 | |||
fafc48cfce | |||
cae5e408bd | |||
869074dd89 | |||
1892d38d18 | |||
d5ca576068 | |||
b1061e56c6 | |||
1fa2667deb
|
|||
19d78991c8
|
|||
1dadaabe94
|
@ -4,9 +4,7 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
pull_request:
|
- develop
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@ -15,5 +13,9 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Check out repository code
|
- name: Check out repository code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Run docker-compose
|
- name: Build production
|
||||||
run: docker compose up -d --build
|
run: docker compose up -d --build prod
|
||||||
|
if: gitea.ref == 'refs/heads/master'
|
||||||
|
- name: Build develop
|
||||||
|
run: docker compose up -d --build dev
|
||||||
|
if: gitea.ref == 'refs/heads/develop'
|
7
TODO.md
7
TODO.md
@ -9,9 +9,10 @@
|
|||||||
- [ ] Type slug of project
|
- [ ] Type slug of project
|
||||||
|
|
||||||
## CI/CD
|
## CI/CD
|
||||||
- [ ] Staging environment
|
- [x] Staging environment
|
||||||
- [ ] Deploy to staging environment on push to master
|
- [x] Deploy to staging environment on push to develop
|
||||||
- [ ] Deploy to production environment on push tag to master
|
- [x] Deploy to production environment on push to master
|
||||||
|
- [ ] Staging environment .env file
|
||||||
|
|
||||||
## SEO
|
## SEO
|
||||||
- [ ] Meta tags on each page
|
- [ ] Meta tags on each page
|
||||||
|
@ -1,9 +1,20 @@
|
|||||||
services:
|
services:
|
||||||
web:
|
prod:
|
||||||
container_name: martials.no
|
hostname: martials.no
|
||||||
|
container_name: "martials.no"
|
||||||
restart: always
|
restart: always
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
ports:
|
ports:
|
||||||
- "4321:4321"
|
- "4321:4321"
|
||||||
|
|
||||||
|
dev:
|
||||||
|
hostname: dev.martials.no
|
||||||
|
container_name: "dev.martials.no"
|
||||||
|
restart: always
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
ports:
|
||||||
|
- "4322:4321"
|
@ -1,6 +0,0 @@
|
|||||||
import { paraglideMiddleware } from "@/paraglide/server";
|
|
||||||
import { defineMiddleware } from "astro/middleware"
|
|
||||||
|
|
||||||
export const onRequest = defineMiddleware((context, next) => {
|
|
||||||
return paraglideMiddleware(context.request, () => next());
|
|
||||||
});
|
|
@ -2,11 +2,12 @@
|
|||||||
import GiteaLink from "./links/GiteaLink.astro"
|
import GiteaLink from "./links/GiteaLink.astro"
|
||||||
import PajamasIcon from "./icons/PajamasIcon.astro"
|
import PajamasIcon from "./icons/PajamasIcon.astro"
|
||||||
import ExternalLink from "./links/ExternalLink.astro"
|
import ExternalLink from "./links/ExternalLink.astro"
|
||||||
import LanguageButtonGroup from "./LanguageButtonGroup.astro"
|
import LanguageButtonGroup from "./LanguageButtonGroup.svelte"
|
||||||
import { GIT_URL, STATUS_URL } from "astro:env/client"
|
import { GIT_URL, STATUS_URL } from "astro:env/client"
|
||||||
import * as m from "@/paraglide/messages"
|
import * as m from "@/paraglide/messages"
|
||||||
|
|
||||||
const giteaLink = `${GIT_URL}/martials/martials.no`
|
const giteaLink = `${GIT_URL}/martials/martials.no`
|
||||||
|
const pathname = Astro.url.pathname
|
||||||
---
|
---
|
||||||
|
|
||||||
<div class="divider bg-inherit"></div>
|
<div class="divider bg-inherit"></div>
|
||||||
@ -28,5 +29,5 @@ const giteaLink = `${GIT_URL}/martials/martials.no`
|
|||||||
{m.status()}
|
{m.status()}
|
||||||
</ExternalLink>
|
</ExternalLink>
|
||||||
</div>
|
</div>
|
||||||
<LanguageButtonGroup />
|
<LanguageButtonGroup client:load />
|
||||||
</div>
|
</div>
|
||||||
|
@ -15,7 +15,7 @@ const isEnglish = pathname.startsWith("/en")
|
|||||||
class:list={[
|
class:list={[
|
||||||
"btn join-item !text-cat-text border-cat-surface0",
|
"btn join-item !text-cat-text border-cat-surface0",
|
||||||
!isEnglish ? "bg-cat-mantle" : "bg-cat-base",
|
!isEnglish ? "bg-cat-mantle" : "bg-cat-base",
|
||||||
]}>Norsk</LocaleLink
|
]} client:load>Norsk</LocaleLink
|
||||||
>
|
>
|
||||||
<LocaleLink
|
<LocaleLink
|
||||||
to={currentPath as NavLink}
|
to={currentPath as NavLink}
|
||||||
@ -23,6 +23,6 @@ const isEnglish = pathname.startsWith("/en")
|
|||||||
class:list={[
|
class:list={[
|
||||||
"btn join-item !text-cat-text border-cat-surface0",
|
"btn join-item !text-cat-text border-cat-surface0",
|
||||||
isEnglish ? "bg-cat-mantle" : "bg-cat-base",
|
isEnglish ? "bg-cat-mantle" : "bg-cat-base",
|
||||||
]}>English</LocaleLink
|
]} client:load>English</LocaleLink
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
29
src/components/LanguageButtonGroup.svelte
Normal file
29
src/components/LanguageButtonGroup.svelte
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { getLocale, type Locale, setLocale } from "@/paraglide/runtime"
|
||||||
|
|
||||||
|
const isEnglish = getLocale() === "en"
|
||||||
|
|
||||||
|
function updateLocale(lang: Locale) {
|
||||||
|
setLocale(lang)
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="join">
|
||||||
|
<button
|
||||||
|
onclick={() => updateLocale("nb")}
|
||||||
|
class={[
|
||||||
|
"btn join-item !text-cat-text border-cat-surface0",
|
||||||
|
!isEnglish ? "bg-cat-mantle" : "bg-cat-base",
|
||||||
|
]}>Norsk
|
||||||
|
</button
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
onclick={() => updateLocale("en")}
|
||||||
|
class={[
|
||||||
|
"btn join-item !text-cat-text border-cat-surface0",
|
||||||
|
isEnglish ? "bg-cat-mantle" : "bg-cat-base",
|
||||||
|
]}>English
|
||||||
|
</button
|
||||||
|
>
|
||||||
|
</div>
|
@ -11,6 +11,7 @@ interface Props extends ComponentProps {
|
|||||||
const { to, class: clazz, lang = getLocale() } = Astro.props
|
const { to, class: clazz, lang = getLocale() } = Astro.props
|
||||||
---
|
---
|
||||||
|
|
||||||
|
<!-- TODO currently not working on Paraglide 2 https://github.com/opral/inlang-paraglide-js/issues/472 -->
|
||||||
<a href={localizeHref(to, { locale: lang })} class={clazz}>
|
<a href={localizeHref(to, { locale: lang })} class={clazz}>
|
||||||
<slot />
|
<slot />
|
||||||
</a>
|
</a>
|
||||||
|
6
src/middleware.ts
Normal file
6
src/middleware.ts
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
import { paraglideMiddleware } from "@/paraglide/server"
|
||||||
|
import { defineMiddleware } from "astro/middleware"
|
||||||
|
|
||||||
|
export const onRequest = defineMiddleware((context, next) => {
|
||||||
|
return paraglideMiddleware(context.request, () => next());
|
||||||
|
});
|
@ -1,17 +1,9 @@
|
|||||||
---
|
---
|
||||||
import ProjectPage from "@/components/projects/ProjectPage.astro"
|
import ProjectPage from "@/components/projects/ProjectPage.astro"
|
||||||
import { type GetStaticPathsResult } from "astro"
|
|
||||||
import "@/styles/global.css"
|
import "@/styles/global.css"
|
||||||
|
|
||||||
// Prerender the page as static HTML during build
|
// Prerender must be false for paraglide js
|
||||||
export const prerender = true
|
export const prerender = false
|
||||||
|
|
||||||
export function getStaticPaths(): GetStaticPathsResult {
|
|
||||||
return [
|
|
||||||
{ params: { project: "homepage" } },
|
|
||||||
{ params: { project: "sb1budget" } },
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
const { project } = Astro.params
|
const { project } = Astro.params
|
||||||
---
|
---
|
||||||
|
@ -1,19 +1,11 @@
|
|||||||
---
|
---
|
||||||
import ProjectPage from "@/components/projects/ProjectPage.astro"
|
import ProjectPage from "@/components/projects/ProjectPage.astro"
|
||||||
import { type GetStaticPathsResult } from "astro"
|
|
||||||
import "@/styles/global.css"
|
import "@/styles/global.css"
|
||||||
|
|
||||||
// Prerender the page as static HTML during build
|
// Prerender must be false for paraglide js
|
||||||
export const prerender = true
|
export const prerender = false
|
||||||
|
|
||||||
export function getStaticPaths(): GetStaticPathsResult {
|
|
||||||
return [
|
|
||||||
{ params: { project: "homepage" } },
|
|
||||||
{ params: { project: "sb1budget" } },
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
const { project } = Astro.params
|
const { project } = Astro.params
|
||||||
---
|
---
|
||||||
|
|
||||||
<ProjectPage project={project as string} />
|
<ProjectPage project={ project as string } />
|
||||||
|
Reference in New Issue
Block a user