Skip to content

Commit 33ac6c3

Browse files
committed
Update github files
1 parent defeb77 commit 33ac6c3

File tree

10 files changed

+368
-0
lines changed

10 files changed

+368
-0
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: [jackyzha0]
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
name: Bug report
3+
about: Something about Quartz isn't working the way you expect
4+
title: ""
5+
labels: bug
6+
assignees: ""
7+
---
8+
9+
**Describe the bug**
10+
A clear and concise description of what the bug is.
11+
12+
**To Reproduce**
13+
Steps to reproduce the behavior:
14+
15+
1. Go to '...'
16+
2. Click on '....'
17+
3. Scroll down to '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Screenshots and Source**
24+
If applicable, add screenshots to help explain your problem.
25+
26+
You can help speed up fixing the problem by either
27+
28+
1. providing a simple reproduction
29+
2. linking to your Quartz repository where the problem can be observed
30+
31+
**Desktop (please complete the following information):**
32+
33+
- Quartz Version: [e.g. v4.1.2]
34+
- `node` Version: [e.g. v18.16]
35+
- `npm` version: [e.g. v10.1.0]
36+
- OS: [e.g. iOS]
37+
- Browser [e.g. chrome, safari]
38+
39+
**Additional context**
40+
Add any other context about the problem here.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea or improvement for Quartz
4+
title: ""
5+
labels: enhancement
6+
assignees: ""
7+
---
8+
9+
**Is your feature request related to a problem? Please describe.**
10+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
11+
12+
**Describe the solution you'd like**
13+
A clear and concise description of what you want to happen.
14+
15+
**Describe alternatives you've considered**
16+
A clear and concise description of any alternative solutions or features you've considered.
17+
18+
**Additional context**
19+
Add any other context or screenshots about the feature request here.

.github/dependabot.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "npm"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
groups:
8+
production-dependencies:
9+
applies-to: "version-updates"
10+
patterns:
11+
- "*"
12+
- package-ecosystem: "github-actions"
13+
directory: "/"
14+
schedule:
15+
interval: "weekly"
16+
groups:
17+
ci-dependencies:
18+
applies-to: "version-updates"
19+
patterns:
20+
- "*"

.github/script/test.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
# Markdown 파일이 있는 디렉토리 (현재 디렉토리 기준)
4+
TARGET_DIR="."
5+
6+
# macOS와 Linux 호환을 위해 `sed` 백업 확장자를 빈 문자열("")로 설정
7+
find "$TARGET_DIR" -type f -name "*.md" | while read -r file; do
8+
# `public/Assets/` -> `Assets/` 변경
9+
if [[ "$OSTYPE" == "darwin"* ]]; then
10+
sed -i "" -E 's|!\[\[public/Assets/|![[Assets/|g' "$file" # macOS
11+
else
12+
sed -i -E 's|!\[\[public/Assets/|![[Assets/|g' "$file" # Linux
13+
fi
14+
15+
echo "✅ Updated: $file"
16+
done
17+
18+
echo "🚀 변환이 완료되었습니다!"

.github/script/update-alias.sh

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/bin/bash
2+
3+
# Markdown 파일이 있는 디렉토리 (현재 디렉토리 기준)
4+
TARGET_DIR="."
5+
6+
# 모든 Markdown 파일을 대상으로 작업 수행
7+
find "$TARGET_DIR" -type f -name "*.md" | while read -r file; do
8+
# 파일명에서 날짜(YYYY-MM-DD)와 제목 부분 추출
9+
filename=$(basename "$file" .md)
10+
11+
if [[ $filename =~ ^([0-9]{4})-([0-9]{2})-([0-9]{2})-(.*)$ ]]; then
12+
year="${BASH_REMATCH[1]}"
13+
month="${BASH_REMATCH[2]}"
14+
day="${BASH_REMATCH[3]}"
15+
title="${BASH_REMATCH[4]}"
16+
17+
# 생성할 aliases 값
18+
alias_value="../articles/${year}-${month}/${title}"
19+
20+
# 새로운 파일 내용을 저장할 변수
21+
new_content=""
22+
inside_aliases=0
23+
alias_already_exists=0
24+
added_alias=0 # 새로운 alias 추가 여부 체크
25+
26+
while IFS= read -r line; do
27+
# `aliases:` 줄을 찾으면 플래그 설정
28+
if [[ "$line" =~ ^aliases: ]]; then
29+
inside_aliases=1
30+
new_content+=$'\n'"$line"
31+
continue
32+
fi
33+
34+
# ` - ...` 형태의 alias 값을 찾으면 중복 확인
35+
if ((inside_aliases == 1)) && [[ "$line" =~ ^[[:space:]]*-[[:space:]] ]]; then
36+
alias_item=$(echo "$line" | sed -E 's/^[[:space:]]*-[[:space:]]*//')
37+
if [[ "$alias_item" == "$alias_value" ]]; then
38+
alias_already_exists=1
39+
fi
40+
fi
41+
42+
# `aliases:` 블록이 끝났을 때 새로운 값 추가 (한 번만 실행)
43+
if ((inside_aliases == 1)) && [[ ! "$line" =~ ^[[:space:]]*-[[:space:]] ]]; then
44+
if ((added_alias == 0 && alias_already_exists == 0)); then
45+
new_content+=$'\n'" - $alias_value"
46+
added_alias=1
47+
fi
48+
inside_aliases=0
49+
fi
50+
51+
# 기존 내용 유지
52+
new_content+=$'\n'"$line"
53+
done < "$file"
54+
55+
# 변환된 내용 덮어쓰기
56+
echo "$new_content" | tail -n +2 > "$file"
57+
58+
echo "✅ Updated: $file (Added alias: $alias_value)"
59+
else
60+
echo "⚠️ Skipped: $file (Filename does not match expected format)"
61+
fi
62+
done
63+
64+
echo "🚀 변환이 완료되었습니다!"

.github/workflows/ci.yaml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Build and Test
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- v4
7+
push:
8+
branches:
9+
- v4
10+
workflow_dispatch:
11+
12+
jobs:
13+
build-and-test:
14+
if: ${{ github.repository == 'jackyzha0/quartz' }}
15+
strategy:
16+
matrix:
17+
os: [windows-latest, macos-latest, ubuntu-latest]
18+
runs-on: ${{ matrix.os }}
19+
permissions:
20+
contents: write
21+
steps:
22+
- uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Setup Node
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: 20
30+
31+
- name: Cache dependencies
32+
uses: actions/cache@v4
33+
with:
34+
path: ~/.npm
35+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
36+
restore-keys: |
37+
${{ runner.os }}-node-
38+
39+
- run: npm ci
40+
41+
- name: Check types and style
42+
run: npm run check
43+
44+
- name: Test
45+
run: npm test
46+
47+
- name: Ensure Quartz builds, check bundle info
48+
run: npx quartz build --bundleInfo
49+
50+
publish-tag:
51+
if: ${{ github.repository == 'jackyzha0/quartz' && github.ref == 'refs/heads/v4' }}
52+
runs-on: ubuntu-latest
53+
permissions:
54+
contents: write
55+
steps:
56+
- uses: actions/checkout@v4
57+
with:
58+
fetch-depth: 0
59+
- name: Setup Node
60+
uses: actions/setup-node@v4
61+
with:
62+
node-version: 20
63+
- name: Get package version
64+
run: node -p -e '`PACKAGE_VERSION=${require("./package.json").version}`' >> $GITHUB_ENV
65+
- name: Create release tag
66+
uses: pkgdeps/git-tag-action@v3
67+
with:
68+
github_token: ${{ secrets.GITHUB_TOKEN }}
69+
github_repo: ${{ github.repository }}
70+
version: ${{ env.PACKAGE_VERSION }}
71+
git_commit_sha: ${{ github.sha }}
72+
git_tag_prefix: "v"

.github/workflows/deploy.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Deploy Quartz site to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: "pages"
15+
cancel-in-progress: false
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-22.04
20+
steps:
21+
- uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0 # Fetch all history for git info
24+
- uses: actions/setup-node@v4
25+
with:
26+
node-version: 22
27+
- name: Install Dependencies
28+
run: npm ci
29+
- name: Build Quartz
30+
run: npx quartz build
31+
- name: Upload artifact
32+
uses: actions/upload-pages-artifact@v3
33+
with:
34+
path: public
35+
36+
deploy:
37+
needs: build
38+
environment:
39+
name: github-pages
40+
url: ${{ steps.deployment.outputs.page_url }}
41+
runs-on: ubuntu-latest
42+
steps:
43+
- name: Deploy to GitHub Pages
44+
id: deployment
45+
uses: actions/deploy-pages@v4
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Docker build & push image
2+
3+
on:
4+
push:
5+
branches: [v4]
6+
tags: ["v*"]
7+
pull_request:
8+
branches: [v4]
9+
paths:
10+
- .github/workflows/docker-build-push.yaml
11+
- quartz/**
12+
workflow_dispatch:
13+
14+
jobs:
15+
build:
16+
if: ${{ github.repository == 'jackyzha0/quartz' }} # Comment this out if you want to publish your own images on a fork!
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Set lowercase repository owner environment variable
20+
run: |
21+
echo "OWNER_LOWERCASE=${OWNER,,}" >> ${GITHUB_ENV}
22+
env:
23+
OWNER: "${{ github.repository_owner }}"
24+
- uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 1
27+
- name: Inject slug/short variables
28+
uses: rlespinasse/[email protected]
29+
- name: Set up QEMU
30+
uses: docker/setup-qemu-action@v3
31+
- name: Set up Docker Buildx
32+
uses: docker/setup-buildx-action@v3
33+
with:
34+
install: true
35+
driver-opts: |
36+
image=moby/buildkit:master
37+
network=host
38+
- name: Install cosign
39+
if: github.event_name != 'pull_request'
40+
uses: sigstore/[email protected]
41+
- name: Login to GitHub Container Registry
42+
uses: docker/login-action@v3
43+
if: github.event_name != 'pull_request'
44+
with:
45+
registry: ghcr.io
46+
username: ${{ github.actor }}
47+
password: ${{ secrets.GITHUB_TOKEN }}
48+
49+
- name: Extract metadata tags and labels on PRs
50+
if: github.event_name == 'pull_request'
51+
id: meta-pr
52+
uses: docker/metadata-action@v5
53+
with:
54+
images: ghcr.io/${{ env.OWNER_LOWERCASE }}/quartz
55+
tags: |
56+
type=raw,value=sha-${{ env.GITHUB_SHA_SHORT }}
57+
labels: |
58+
org.opencontainers.image.source="https://github.com/${{ github.repository_owner }}/quartz"
59+
- name: Extract metadata tags and labels for main, release or tag
60+
if: github.event_name != 'pull_request'
61+
id: meta
62+
uses: docker/metadata-action@v5
63+
with:
64+
flavor: |
65+
latest=auto
66+
images: ghcr.io/${{ env.OWNER_LOWERCASE }}/quartz
67+
tags: |
68+
type=semver,pattern={{version}}
69+
type=semver,pattern={{major}}.{{minor}}
70+
type=semver,pattern={{major}}.{{minor}}.{{patch}}
71+
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
72+
type=raw,value=sha-${{ env.GITHUB_SHA_SHORT }}
73+
labels: |
74+
maintainer=${{ github.repository_owner }}
75+
org.opencontainers.image.source="https://github.com/${{ github.repository_owner }}/quartz"
76+
77+
- name: Build and push Docker image
78+
id: build-and-push
79+
uses: docker/build-push-action@v6
80+
with:
81+
push: ${{ github.event_name != 'pull_request' }}
82+
build-args: |
83+
GIT_SHA=${{ env.GITHUB_SHA }}
84+
DOCKER_LABEL=sha-${{ env.GITHUB_SHA_SHORT }}
85+
tags: ${{ steps.meta.outputs.tags || steps.meta-pr.outputs.tags }}
86+
labels: ${{ steps.meta.outputs.labels || steps.meta-pr.outputs.labels }}
87+
cache-from: type=gha
88+
cache-to: type=gha

.tool-versions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodejs 22.7.0

0 commit comments

Comments
 (0)