Blog Setting

Github 사용해서 블로그 만들기 - 4 (With Prviate Repo)

Somaz 2025. 3. 17. 15:42
728x90
반응형

Overview

이번시간에는 블로그이기 때문에 내 블로그 소스들을 Public으로 오픈하고 싶지 않을 경우 Prviate → Public Repo로 빌드 배포되는 파이프라인을 작성하는 방법에 대해서 알아본다.

 

 

 

📅 관련 글

2025.01.24 - [Blog Setting] - Github 사용해서 블로그 만들기 - 1 (With jekyll)

2025.01.24 - [Blog Setting] - Github 사용해서 블로그 만들기 - 2 (With discus, formspree, mermaid)

 

 

 


 

 

 

Prviate → Public Repo 빌드/ 배포 파이프라인 만들기

 

 

1. Public Repo 소스 코드를  Prviate Repo로 이동

  • Private Repo 생성
  • Public Repo 소스 코드 Private Repo로 이동
  • Public Repo 비우기

 

 

 

2. Prviate Repo에 Workflow 작성

  • Github Personal Access Token 필요
name: Build and Deploy Jekyll Blog

on:
  push:
    branches:
      - main  # main 브랜치에 push 시 자동 실행
  workflow_dispatch:

permissions:
  contents: write  # 공개 저장소에 푸시 권한

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout Repository
        uses: actions/checkout@v3

      - name: Build with Jekyll
        uses: actions/jekyll-build-pages@v1
        with:
          source: .
          destination: ./_site

      - name: Deploy to Public Repository
        uses: peaceiris/actions-gh-pages@v3
        with:
          personal_token: ${{ secrets.DEPLOY_TOKEN }}
          publish_dir: ./_site
          external_repository: somaz94/somaz94.github.io  # 공개 저장소
          publish_branch: main

 

 

 

 

3. Workflow 확인

 

Private Repo

 

 

Public Repo

 

 

 

 

 


 

 

 

 

 

마무리

🔔 요약
  • 물론 모든 소스코드를 숨길 순 없다. 그래도 index.html 형태로 들어가게 된다.
  • 따라서 컨텐츠 복붙(복사/붙여넣기)을 방지할 수 있다.(완벽하진 않음)
  • 빌드 배포에 대한 시간도 오래걸리지 않기 때문에 아주 유용하다.

 

 


Reference

https://somaz94.github.io/

728x90
반응형