mirror of
https://github.com/TheRealOwenRees/chess-scribe-website.git
synced 2026-07-23 01:46:57 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
0795daba4b
|
|||
|
f139449d9a
|
@@ -0,0 +1,53 @@
|
|||||||
|
name: Production Deploy
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: ghcr.io
|
||||||
|
GH_USER: therealowenrees
|
||||||
|
IMAGE_NAME: therealowenrees/chess-scribe:latest
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish:
|
||||||
|
name: publish image
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: Login to Github Container Registry
|
||||||
|
run: echo "${{ secrets.GHCR_SECRET }}" | docker login ghcr.io -u ${{ env.GH_USER }} --password-stdin
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Build image and publish with Cache
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: true
|
||||||
|
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
needs: publish
|
||||||
|
name: deploy image
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Connect and pull image from GHCR
|
||||||
|
uses: appleboy/ssh-action@v1.2.5
|
||||||
|
with:
|
||||||
|
host: ${{ secrets.HOST }}
|
||||||
|
username: ${{ secrets.USERNAME }}
|
||||||
|
key: ${{ secrets.SSH_KEY }}
|
||||||
|
port: ${{ secrets.PORT }}
|
||||||
|
script: |
|
||||||
|
cd /home/${{ secrets.USERNAME }}
|
||||||
|
echo "${{ secrets.GHCR_SECRET }}" | docker login ghcr.io -u ${{ env.GH_USER }} --password-stdin
|
||||||
|
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||||
|
docker compose up -d
|
||||||
@@ -10,6 +10,4 @@
|
|||||||
- react query on for study and chapter load, to allow caching
|
- react query on for study and chapter load, to allow caching
|
||||||
- https://specification.website/checklist/
|
- https://specification.website/checklist/
|
||||||
|
|
||||||
- Custom headers do not work - the subtitle is appearing above every thing on first page, and the game starts 2nd page
|
|
||||||
|
|
||||||
- react query to cache the study and chapters
|
- react query to cache the study and chapters
|
||||||
@@ -28,6 +28,8 @@ const LichessStudyLinkInput = ({ setSelectedStudyId }: IProps) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(result.data);
|
||||||
|
|
||||||
setSelectedStudyId(result.data);
|
setSelectedStudyId(result.data);
|
||||||
toast.success("Study loaded — pick a chapter");
|
toast.success("Study loaded — pick a chapter");
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ import {
|
|||||||
type Dispatch,
|
type Dispatch,
|
||||||
useActionState,
|
useActionState,
|
||||||
useEffect,
|
useEffect,
|
||||||
useRef,
|
// useRef,
|
||||||
useState,
|
useState,
|
||||||
} from "react";
|
} from "react";
|
||||||
import { toast } from "react-toastify";
|
import { toast } from "react-toastify";
|
||||||
import { useClickOutside } from "#/hooks/useClickOutside.ts";
|
// import { useClickOutside } from "#/hooks/useClickOutside.ts";
|
||||||
import { useLichess } from "#/hooks/useLichess.ts";
|
import { useLichess } from "#/hooks/useLichess.ts";
|
||||||
import type { IUserStudyChapter } from "#/interfaces.ts";
|
import type { IUserStudyChapter } from "#/interfaces.ts";
|
||||||
import type { GameAction } from "#/reducers/gameReducer.ts";
|
import type { GameAction } from "#/reducers/gameReducer.ts";
|
||||||
@@ -31,7 +31,7 @@ const initialChapterState: ChapterState = {
|
|||||||
const SelectStudyChapter = ({ selectedStudyId, gameDispatch }: IProps) => {
|
const SelectStudyChapter = ({ selectedStudyId, gameDispatch }: IProps) => {
|
||||||
const [isOpen, setIsOpen] = useState(false);
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
const [search, setSearch] = useState("");
|
const [search, setSearch] = useState("");
|
||||||
const dropdownRef = useRef<HTMLDivElement>(null);
|
// const dropdownRef = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
const { getLichessStudyChapters, loadLichessStudyChapter } = useLichess();
|
const { getLichessStudyChapters, loadLichessStudyChapter } = useLichess();
|
||||||
|
|
||||||
@@ -47,6 +47,9 @@ const SelectStudyChapter = ({ selectedStudyId, gameDispatch }: IProps) => {
|
|||||||
const result = await getLichessStudyChapters({
|
const result = await getLichessStudyChapters({
|
||||||
studyId: selectedStudyId,
|
studyId: selectedStudyId,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log(result);
|
||||||
|
|
||||||
if (result.ok) {
|
if (result.ok) {
|
||||||
return {
|
return {
|
||||||
status: "success",
|
status: "success",
|
||||||
@@ -54,6 +57,7 @@ const SelectStudyChapter = ({ selectedStudyId, gameDispatch }: IProps) => {
|
|||||||
error: null,
|
error: null,
|
||||||
} satisfies ChapterState;
|
} satisfies ChapterState;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
status: "error",
|
status: "error",
|
||||||
chapters: [],
|
chapters: [],
|
||||||
@@ -67,7 +71,7 @@ const SelectStudyChapter = ({ selectedStudyId, gameDispatch }: IProps) => {
|
|||||||
chapter.name.toLowerCase().includes(search.toLowerCase()),
|
chapter.name.toLowerCase().includes(search.toLowerCase()),
|
||||||
);
|
);
|
||||||
|
|
||||||
useClickOutside({ isOpen, setIsOpen, setSearch, ref: dropdownRef });
|
// useClickOutside({ isOpen, setIsOpen, setSearch, ref: dropdownRef });
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isPending || chapterState.status === "success") {
|
if (isPending || chapterState.status === "success") {
|
||||||
|
|||||||
@@ -65,7 +65,10 @@ const Chessboard = () => {
|
|||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
{user ? (
|
{user ? (
|
||||||
|
<div className="flex flex-col">
|
||||||
|
<p className="text-center">or</p>
|
||||||
<LichessStudyLinkInput setSelectedStudyId={setSelectedStudyId} />
|
<LichessStudyLinkInput setSelectedStudyId={setSelectedStudyId} />
|
||||||
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
</Section>
|
</Section>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user