fix: 修复 Gitea 图标不渲染,简化 CI workflow

- 修复 gitea-logo :before 伪元素缺少公共样式选择器的问题

- 替换错误的 Gitea SVG path 为正确 logo

- 重构 Gitea card 组件使用 giteaConfig 统一管理域名

- 更新 Gitea 链接域名 (gitea -> git)

- 添加 simple-icons 图标包支持

- 删除未使用的 gitea-logo.svg

- 删除 GitHub Pages 部署 workflow (使用 Vercel)

- 删除 biome 代码质量检查 workflow

- 简化 build workflow,单版本 Node 22,仅构建
This commit is contained in:
2026-06-27 17:34:17 +08:00
parent 590bd54a6a
commit 3aff09be78
11 changed files with 77 additions and 146 deletions
-20
View File
@@ -1,20 +0,0 @@
name: Code quality
on:
push:
branches: [ main ] # Adjust branches as needed
pull_request:
branches: [ main ] # Adjust branches as needed
jobs:
quality:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Biome
uses: biomejs/setup-biome@f382a98e582959e6aaac8e5f8b17b31749018780 # v2.5.0
with:
version: latest
- name: Run Biome
run: biome ci ./src --reporter=github
+12 -49
View File
@@ -1,67 +1,30 @@
name: Build and Check
name: Build
on:
push:
branches: [ main ] # Adjust branches as needed
branches: [main]
pull_request:
branches: [ main ] # Adjust branches as needed
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
branches: [main]
jobs:
check:
strategy:
matrix:
node: [ 22, 23 ]
runs-on: ubuntu-latest
name: Astro Check for Node.js ${{ matrix.node }}
steps:
- name: Setup Node.js
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
with:
node-version: ${{ matrix.node }} # Use LTS
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup pnpm
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
with:
run_install: false # Disable auto-install
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run Astro Check
run: pnpm astro check
build:
strategy:
matrix:
node: [ 22, 23 ]
runs-on: ubuntu-latest
name: Astro Build for Node.js ${{ matrix.node }} # Corrected job name
steps:
- name: Setup Node.js
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
with:
node-version: ${{ matrix.node }}
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
uses: pnpm/action-setup@v4
with:
run_install: false # Disable auto-install
run_install: false
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run Astro Build
- name: Build
run: pnpm astro build
-35
View File
@@ -1,35 +0,0 @@
name: Deploy to GitHub Pages
on:
# Trigger the workflow every time you push to the `main` branch
# Using a different branch name? Replace `main` with your branchs name
push:
branches: [main]
# Allows you to run this workflow manually from the Actions tab on GitHub.
workflow_dispatch:
# Allow this job to clone the repo and create a page deployment
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout your repository using git
uses: actions/checkout@v5
- name: Install, build, and upload your site
uses: withastro/action@v4
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
+1
View File
@@ -54,6 +54,7 @@ export default defineConfig({
"fa6-brands": ["*"],
"fa6-regular": ["*"],
"fa6-solid": ["*"],
"simple-icons": ["gitea"],
},
}),
expressiveCode({
+1
View File
@@ -30,6 +30,7 @@
"@iconify-json/fa6-regular": "^1.2.4",
"@iconify-json/fa6-solid": "^1.2.4",
"@iconify-json/material-symbols": "^1.2.60",
"@iconify-json/simple-icons": "^1.2.87",
"@iconify/svelte": "^4.2.0",
"@swup/astro": "^1.8.0",
"@tailwindcss/typography": "^0.5.19",
+10
View File
@@ -50,6 +50,9 @@ importers:
'@iconify-json/material-symbols':
specifier: ^1.2.60
version: 1.2.60
'@iconify-json/simple-icons':
specifier: ^1.2.87
version: 1.2.87
'@iconify/svelte':
specifier: ^4.2.0
version: 4.2.0(svelte@5.53.7)
@@ -1269,6 +1272,9 @@ packages:
'@iconify-json/material-symbols@1.2.60':
resolution: {integrity: sha512-bmVrnz/9KJNh/j+nO3pyxzo0h8iENIKxv5RASDURhjKdPI53rRcKN7E2Gmwi25k9CBJ+IC6L9l0AGgngeqyRuw==}
'@iconify-json/simple-icons@1.2.87':
resolution: {integrity: sha512-8YciStObhSji3OZFmWAWK6kBujyqO5bLCxeDwLxf3CR3F4PVelq7keC2LBvgTqviWzSTysj5/g4PCFLiAMVGsw==}
'@iconify/svelte@4.2.0':
resolution: {integrity: sha512-fEl0T7SAPonK7xk6xUlRPDmFDZVDe2Z7ZstlqeDS/sS8ve2uyU+Qa8rTWbIqzZJlRvONkK5kVXiUf9nIc+6OOQ==}
peerDependencies:
@@ -6924,6 +6930,10 @@ snapshots:
dependencies:
'@iconify/types': 2.0.0
'@iconify-json/simple-icons@1.2.87':
dependencies:
'@iconify/types': 2.0.0
'@iconify/svelte@4.2.0(svelte@5.53.7)':
dependencies:
'@iconify/types': 2.0.0
+9 -4
View File
@@ -1,5 +1,6 @@
import type {
ExpressiveCodeConfig,
GiteaConfig,
LicenseConfig,
MusicPlayerConfig,
NavBarConfig,
@@ -55,8 +56,8 @@ export const navBarConfig: NavBarConfig = {
LinkPreset.About,
{
name: "Gitea",
url: "https://gitea.atdunbg.xyz/atdunbg", // Internal links should not include the base path, as it is automatically added
external: true, // Show an external link icon and will open in a new tab
url: "https://git.atdunbg.xyz/atdunbg",
external: true,
},
],
};
@@ -85,8 +86,8 @@ export const profileConfig: ProfileConfig = {
},
{
name: "Gitea",
icon: "fa6-brands:git",
url: "https://gitea.atdunbg.xyz/atdunbg",
icon: "simple-icons:gitea",
url: "https://git.atdunbg.xyz/atdunbg",
},
],
};
@@ -107,3 +108,7 @@ export const twikooConfig: TwikooConfig = {
enable: true,
envId: "https://twikoo.atdunbg.xyz",
};
export const giteaConfig: GiteaConfig = {
domain: "git.atdunbg.xyz",
};
-2
View File
@@ -5,8 +5,6 @@
欢迎来到[Atdunbg](https://atdunbg.xyz)的小站, 这里是一个又菜又爱学的技术小白。
本人就读与一所郑州的不知名本科学院, 学的软件工程,目前已经大四了。
+30 -34
View File
@@ -1,14 +1,7 @@
/// <reference types="mdast" />
import { h } from "hastscript";
import { giteaConfig } from "../config.ts";
/**
* Creates a Gitea Card component.
*
* @param {Object} properties - The properties of the component.
* @param {string} properties.repo - The Gitea repository in the format "owner/repo".
* @param {import('mdast').RootContent[]} children - The children elements of the component.
* @returns {import('mdast').Parent} The created Gitea Card component.
*/
export function GiteaCardComponent(properties, children) {
if (Array.isArray(children) && children.length !== 0)
return h("div", { class: "hidden" }, [
@@ -23,9 +16,8 @@ export function GiteaCardComponent(properties, children) {
);
const repo = properties.repo;
const cardUuid = `GC${Math.random().toString(36).slice(-6)}`; // 唯一标识
const cardUuid = `GC${Math.random().toString(36).slice(-6)}`;
// 创建头像占位元素(Gitea API 也提供头像 URL
const nAvatar = h(`div#${cardUuid}-avatar`, { class: "gc-avatar" });
const nLanguage = h(
`span#${cardUuid}-language`,
@@ -42,7 +34,7 @@ export function GiteaCardComponent(properties, children) {
h("div", { class: "gc-divider" }, "/"),
h("div", { class: "gc-repo" }, repo.split("/")[1]),
]),
h("div", { class: "gitea-logo" }), // 可以换成 Gitea 图标
h("div", { class: "gitea-logo" }),
]);
const nDescription = h(
@@ -53,33 +45,36 @@ export function GiteaCardComponent(properties, children) {
const nStars = h(`div#${cardUuid}-stars`, { class: "gc-stars" }, "00K");
const nForks = h(`div#${cardUuid}-forks`, { class: "gc-forks" }, "0K");
// Gitea 可能没有 license 字段,可以去掉或显示其他信息
const nLicense = h(`div#${cardUuid}-license`, { class: "gc-license" }, "");
const nScript = h(
`script#${cardUuid}-script`,
{ type: "text/javascript", defer: true },
`
fetch('https://gitea.atdunbg.xyz/api/v1/repos/${repo}', { referrerPolicy: "no-referrer" })
.then(response => response.json())
.then(data => {
document.getElementById('${cardUuid}-description').innerText = data.description || "No description";
document.getElementById('${cardUuid}-language').innerText = data.language || "Not specified";
document.getElementById('${cardUuid}-forks').innerText = Intl.NumberFormat('en-us', { notation: "compact", maximumFractionDigits: 1 }).format(data.forks_count || 0).replaceAll("\\u202f", "");
document.getElementById('${cardUuid}-stars').innerText = Intl.NumberFormat('en-us', { notation: "compact", maximumFractionDigits: 1 }).format(data.stars_count || 0).replaceAll("\\u202f", "");
const avatarEl = document.getElementById('${cardUuid}-avatar');
avatarEl.style.backgroundImage = 'url(' + data.owner.avatar_url + ')';
avatarEl.style.backgroundColor = 'transparent';
// 如果 Gitea API 返回 license 信息,可以显示
// document.getElementById('${cardUuid}-license').innerText = data.license?.spdx_id || "no-license";
document.getElementById('${cardUuid}-card').classList.remove("fetch-waiting");
console.log("[GITEA-CARD] Loaded card for ${repo} | ${cardUuid}.");
})
.catch(err => {
const c = document.getElementById('${cardUuid}-card');
c?.classList.add("fetch-error");
console.warn("[GITEA-CARD] (Error) Loading card for ${repo} | ${cardUuid}.", err);
});
(function() {
var card = document.getElementById('${cardUuid}-card');
var domain = card.getAttribute('data-gitea-domain');
var repo = card.getAttribute('data-repo');
fetch('https://' + domain + '/api/v1/repos/' + repo, { referrerPolicy: "no-referrer" })
.then(response => response.json())
.then(data => {
document.getElementById('${cardUuid}-description').innerText = data.description || "No description";
document.getElementById('${cardUuid}-language').innerText = data.language || "Not specified";
document.getElementById('${cardUuid}-forks').innerText = Intl.NumberFormat('en-us', { notation: "compact", maximumFractionDigits: 1 }).format(data.forks_count || 0).replaceAll("\\u202f", "");
document.getElementById('${cardUuid}-stars').innerText = Intl.NumberFormat('en-us', { notation: "compact", maximumFractionDigits: 1 }).format(data.stars_count || 0).replaceAll("\\u202f", "");
var avatarEl = document.getElementById('${cardUuid}-avatar');
avatarEl.style.backgroundImage = 'url(' + data.owner.avatar_url + ')';
avatarEl.style.backgroundColor = 'transparent';
document.getElementById('${cardUuid}-card').classList.remove("fetch-waiting");
console.log("[GITEA-CARD] Loaded card for " + repo + " | ${cardUuid}.");
})
.catch(err => {
var c = document.getElementById('${cardUuid}-card');
c?.classList.add("fetch-error");
console.warn("[GITEA-CARD] (Error) Loading card for " + repo + " | ${cardUuid}.", err);
});
})();
`,
);
@@ -87,9 +82,10 @@ export function GiteaCardComponent(properties, children) {
`a#${cardUuid}-card`,
{
class: "card-gitea fetch-waiting no-styling",
href: `https://gitea.atdunbg.xyz/${repo}`,
href: "https://" + giteaConfig.domain + "/" + repo,
target: "_blank",
repo,
"data-gitea-domain": giteaConfig.domain,
"data-repo": repo,
},
[
nTitle,
+10 -2
View File
@@ -163,7 +163,7 @@ a.card-github, a.card-gitea
.gc-language
display: none
.gc-stars, .gc-forks, .gc-license, .github-logo
.gc-stars, .gc-forks, .gc-license, .github-logo, .gitea-logo
font-weight: 500
font-size: 0.875rem
opacity: 0.9;
@@ -206,6 +206,14 @@ a.card-github, a.card-gitea
margin-right: 0
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='31' height='32' viewBox='0 0 496 512'%3E%3Cpath fill='%23a1f7cb' d='M165.9 397.4c0 2-2.3 3.6-5.2 3.6c-3.3.3-5.6-1.3-5.6-3.6c0-2 2.3-3.6 5.2-3.6c3-.3 5.6 1.3 5.6 3.6m-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9c2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3m44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9c.3 2 2.9 3.3 5.9 2.6c2.9-.7 4.9-2.6 4.6-4.6c-.3-1.9-3-3.2-5.9-2.9M244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2c12.8 2.3 17.3-5.6 17.3-12.1c0-6.2-.3-40.4-.3-61.4c0 0-70 15-84.7-29.8c0 0-11.4-29.1-27.8-36.6c0 0-22.9-15.7 1.6-15.4c0 0 24.9 2 38.6 25.8c21.9 38.6 58.6 27.5 72.9 20.9c2.3-16 8.8-27.1 16-33.7c-55.9-6.2-112.3-14.3-112.3-110.5c0-27.5 7.6-41.3 23.6-58.9c-2.6-6.5-11.1-33.3 2.6-67.9c20.9-6.5 69 27 69 27c20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27c13.7 34.7 5.2 61.4 2.6 67.9c16 17.7 25.8 31.5 25.8 58.9c0 96.5-58.9 104.2-114.8 110.5c9.2 7.9 17 22.9 17 46.4c0 33.7-.3 75.4-.3 83.6c0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252C496 113.3 383.5 8 244.8 8M97.2 352.9c-1.3 1-1 3.3.7 5.2c1.6 1.6 3.9 2.3 5.2 1c1.3-1 1-3.3-.7-5.2c-1.6-1.6-3.9-2.3-5.2-1m-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9c1.6 1 3.6.7 4.3-.7c.7-1.3-.3-2.9-2.3-3.9c-2-.6-3.6-.3-4.3.7m32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2c2.3 2.3 5.2 2.6 6.5 1c1.3-1.3.7-4.3-1.3-6.2c-2.2-2.3-5.2-2.6-6.5-1m-11.4-14.7c-1.6 1-1.6 3.6 0 5.9c1.6 2.3 4.3 3.3 5.6 2.3c1.6-1.3 1.6-3.9 0-6.2c-1.4-2.3-4-3.3-5.6-2'/%3E%3C/svg%3E")
.gitea-logo
font-size: 1.25rem
&:before
background-color: var(--tw-prose-headings)
margin-right: 0
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4.209 4.603c-.247 0-.525.02-.84.088-.333.07-1.28.283-2.054 1.027C-.403 7.25.035 9.685.089 10.052c.065.446.263 1.687 1.21 2.768 1.749 2.141 5.513 2.092 5.513 2.092s.462 1.103 1.168 2.119c.955 1.263 1.936 2.248 2.89 2.367 2.406 0 7.212-.004 7.212-.004s.458.004 1.08-.394c.535-.324 1.013-.893 1.013-.893s.492-.527 1.18-1.73c.21-.37.385-.729.538-1.068c0 0 2.107-4.471 2.107-8.823-.042-1.318-.367-1.55-.443-1.627-.156-.156-.366-.153-.366-.153s-4.475.252-6.792.306c-.508.011-1.012.023-1.512.027v4.474l-.634-.301c0-1.39-.004-4.17-.004-4.17-1.107.016-3.405-.084-3.405-.084s-5.399-.27-5.987-.324c-.187-.011-.401-.032-.648-.032zm.354 1.832h.111s.271 2.269.6 3.597C5.549 11.147 6.22 13 6.22 13s-.996-.119-1.641-.348c-.99-.324-1.409-.714-1.409-.714s-.73-.511-1.096-1.52C1.444 8.73 2.021 7.7 2.021 7.7s.32-.859 1.47-1.145c.395-.106.863-.12 1.072-.12zm8.33 2.554c.26.003.509.127.509.127l.868.422-.529 1.075a.686.686 0 0 0-.614.359.685.685 0 0 0 .072.756l-.939 1.924a.69.69 0 0 0-.66.527.687.687 0 0 0 .347.763.686.686 0 0 0 .867-.206.688.688 0 0 0-.069-.882l.916-1.874a.667.667 0 0 0 .237-.02.657.657 0 0 0 .271-.137 8.826 8.826 0 0 1 1.016.512.761.761 0 0 1 .286.282c.073.21-.073.569-.073.569-.087.29-.702 1.55-.702 1.55a.692.692 0 0 0-.676.477.681.681 0 1 0 1.157-.252c.073-.141.141-.282.214-.431.19-.397.515-1.16.515-1.16.035-.066.218-.394.103-.814-.095-.435-.48-.638-.48-.638-.467-.301-1.116-.58-1.116-.58s0-.156-.042-.27a.688.688 0 0 0-.148-.241l.516-1.062 2.89 1.401s.48.218.583.619c.073.282-.019.534-.069.657-.24.587-2.1 4.317-2.1 4.317s-.232.554-.748.588a1.065 1.065 0 0 1-.393-.045l-.202-.08-4.31-2.1s-.417-.218-.49-.596c-.083-.31.104-.691.104-.691l2.073-4.272s.183-.37.466-.497a.855.855 0 0 1 .35-.077z'/%3E%3C/svg%3E")
a.card-github.fetch-waiting, a.card-gitea.fetch-waiting
pointer-events: none
opacity: 0.7
@@ -239,7 +247,7 @@ a.card-github.fetch-error, a.card-gitea.fetch-error
100%
opacity: 0.15
.card-github, .card-gitea, .gc-description, .gc-titlebar, .gc-stars, .gc-forks, .gc-license, .gc-avatar, .github-logo
.card-github, .card-gitea, .gc-description, .gc-titlebar, .gc-stars, .gc-forks, .gc-license, .gc-avatar, .github-logo, .gitea-logo
transition-property: all
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1)
transition-duration: 0.15s
+4
View File
@@ -117,3 +117,7 @@ export type MusicPlayerConfig = {
server?: "netease" | "tencent" | "kugou" | "xiami" | "baidu";
defaultVolume?: number;
};
export type GiteaConfig = {
domain: string;
};