Skip to main content

Velog 글을 Markdown으로 백업 (시리즈별 폴더) — velog_sync PyPI 패키지 실행

Project description

License: MIT

velog-sync

Velog 글을 GraphQL(Graph Query Language) API 로 가져와 시리즈별 폴더/Markdown 으로 저장합니다. 작성/수정 시각은 KST 로 변환해 파일에 함께 기록됩니다.

GitHub Actions

name: velog-sync (daily KST 03:00)

on:
    schedule:
        - cron: "0 18 * * *" # 매일 03:00 KST
    workflow_dispatch: {}

permissions:
    contents: write

jobs:
    sync:
        runs-on: ubuntu-latest
        environment: velog_sync
        steps:
            - name: Checkout
              uses: actions/checkout@v4

            - name: Set up Python
              uses: actions/setup-python@v5
              with:
                  python-version: "3.11"

            - name: Install velog-sync
              run: |
                  python -m pip install --upgrade pip
                  pip install velog-sync

            - name: Configure Git
              run: |
                  git config user.name "github-actions[bot]"
                  git config user.email "41898282+github-actions[bot]@users.noreply.github.com"

            - name: Rebase with remote main
              run: |
                  git pull --rebase origin main

            - name: Run velog-sync
              env:
                  VELOG_USERNAME: ${{ vars.VELOG_USERNAME }}
              run: velog-sync

            - name: Commit if changed
              env:
                  TZ: Asia/Seoul
              run: |
                  if [ -n "$(git status --porcelain)" ]; then
                    DATE_KST="$(date +'%Y-%m-%d %H:%M:%S %Z')"
                    git add -A
                    git commit -m "velog sync @ ${DATE_KST}"
                    git push
                  else
                    echo "No changes to commit."
                  fi

환경 설정

  • 위의 Actions yml 파일을 Velog 백업용 repo 에 등록합니다.
  • Actions environment로 velog_sync를 지정합니다.
  • velog_sync 환경변수에 글로벌 변수로 VELOG_USERNAME에 자신의 velog 계정 이름을 설정합니다.
  • 최초 등록 후 run-jobs를 통해 Actions를 실행합니다.
  • 매일 03:00 마다 자동으로 업데이트 됩니다.

로컬 설치

요구 사항

  • Python 3.10+

pyproject.toml은 단일 모듈(루트의 velog_sync.py)을 패키징하도록 설정되어 있습니다.

설치

pip install velog-sync

실행

환경변수 VELOG_USERNAME(본인 벨로그 사용자명, @ 제외)을 반드시 지정한 뒤 모듈 실행:

macOS/Linux

export VELOG_USERNAME=user-name
velog-sync

Windows (PowerShell)

$env:VELOG_USERNAME = "user-name"
velog-sync

Windows (CMD)

set VELOG_USERNAME=user-name
velog-sync

출력 구조

출력 경로는 ./입니다. 각 파일 상단에는:

  • Velog 원문 링크
  • released at, updated at (KST)
  • 태그 테이블(클릭 시 velog 태그 페이지로 이동)

문의/개선 제안은 이슈로 남겨주세요.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

velog_sync-0.2.0.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

velog_sync-0.2.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file velog_sync-0.2.0.tar.gz.

File metadata

  • Download URL: velog_sync-0.2.0.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for velog_sync-0.2.0.tar.gz
Algorithm Hash digest
SHA256 8bff31c2fed0bc46ef29b06d5a3d3795fa89f0780b2cd2e1db0cc2363dc762b0
MD5 55438e99fa9fdc2e9c14769f26cda2d2
BLAKE2b-256 87dad588ec8e93de709191c10497f28df3c47eb5f87a072a32734c44b78dc5b1

See more details on using hashes here.

Provenance

The following attestation bundles were made for velog_sync-0.2.0.tar.gz:

Publisher: publish.yml on choi-hyk/velog_sync

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file velog_sync-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: velog_sync-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for velog_sync-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1e20a9afe74b7f59552c66734fa8b1ba1cc88c5ec17f8338561885dd5ccc5c00
MD5 dc568914b263d6a40d561ee87e55258d
BLAKE2b-256 2dff9e345a2e2b5446b1a0f012bfba7cbcc9cd18e48cee9b9bda7d2f675a5493

See more details on using hashes here.

Provenance

The following attestation bundles were made for velog_sync-0.2.0-py3-none-any.whl:

Publisher: publish.yml on choi-hyk/velog_sync

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page