배포하기
더 많은 작업
Wikven은 서버나 데이터베이스 없이 자체 완결된 정적 파일 dist/ 디렉터리를 생성합니다. 정적 파일을 제공하는 곳이라면 어디서나 호스팅할 수 있습니다.
GitHub Pages
이 워크플로는 푸시할 때마다 사이트를 다시 빌드하고 게시합니다. Wikven 복합 액션으로 소스를 빌드한 뒤 dist/를 Pages에 업로드합니다.
name: Deploy
on:
push:
branches: [main]
permissions:
contents: read
pages: write
id-token: write
jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deploy.outputs.page_url }}
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
# Whole history, so each page is dated at the commit that last changed
# its source file. A shallow checkout knows only the latest commit.
fetch-depth: 0
- uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0
- uses: chaotic-ground/wikven/actions/bake@19392b75d379de9e349ef2963c11ec5545c3e6ab # v1.0.0
with:
source: src
output: dist
- uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: dist
- id: deploy
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0
저장소의 Settings → Pages → Build and deployment → Source: GitHub Actions에서 Pages를 활성화하세요. 이 문서 사이트도 이렇게 게시됩니다.
GitHub 프로젝트 페이지는 하위 디렉터리(username.github.io/repo/)에서 제공됩니다. Wikven은 문서 간 링크를 상대 경로로 작성하므로 페이지 사이의 링크는 계속 동작하지만, 절대 경로가 필요한 것은 그 기본 경로를 포함해야 합니다. 검색의 SifterSearchBundlePath를 /repo/pagefind/로 설정하세요 (이 사이트는 /wikven/pagefind/를 사용합니다). 사용자/조직 페이지(도메인 루트에서 제공)에는 그런 설정이 필요 없습니다.
임의의 정적 호스트
dist/는 그저 파일 모음이므로, 어떤 정적 호스트(Netlify, Cloudflare Pages, S3 같은 객체 저장소, 또는 평범한 웹 서버)에서도 제공할 수 있습니다. CI나 로컬에서 사이트를 빌드한 뒤, 호스트가 dist/ 디렉터리를 가리키게 하거나 그 내용을 서버의 문서 루트에 업로드하세요.
로컬에서 미리 보기
dist/index.html을 직접 열거나, 링크와 자산이 프로덕션에서와 똑같이 해석되도록 디렉터리를 제공하세요. Wikven에는 이를 위한 serve 명령이 내장되어 있습니다.
단독 실행 바이너리를 쓰면 dist/를 http://localhost:8080에서 제공합니다 (--listen으로 변경):
wikven serve
Docker 이미지를 쓸 때는 serve 명령을 실행하고 포트를 공개하세요 (빌드 출력이 마운트된 dist/에 이미 있어야 합니다):
docker run --rm -p 8080:8080 \
-v "$(pwd)/dist:/workspace/dist" \
ghcr.io/chaotic-ground/wikven serve
임의의 정적 서버도 됩니다. 예를 들어 cd dist && python3 -m http.server처럼요.