diff --git a/.github/workflows/preview-pages.yml b/.github/workflows/preview-pages.yml new file mode 100644 index 0000000..929e4f0 --- /dev/null +++ b/.github/workflows/preview-pages.yml @@ -0,0 +1,48 @@ +name: Preview Pages +on: + workflow_dispatch: +permissions: {} +concurrency: + group: site-data-${{ github.repository }} + cancel-in-progress: false +jobs: + build: + if: github.repository == 'shendeguize/OrganonCore' && github.ref == 'refs/heads/main' + runs-on: ubuntu-24.04 + timeout-minutes: 30 + env: + ORGANON_SITE_PREVIEW: 'true' + permissions: + contents: read + steps: + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 + with: + path: product + persist-credentials: false + - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 + with: + node-version: '22.23.2' + - name: Install locked site build dependencies + working-directory: product/tools/site + run: npm ci --ignore-scripts + - name: Build and check current site preview + working-directory: product + env: + ORGANON_CORE_ROOT: ${{ github.workspace }}/product + run: npm run check:site + - uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa + with: + path: product/dist/site/ + deploy: + needs: build + runs-on: ubuntu-24.04 + timeout-minutes: 10 + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e + id: deployment \ No newline at end of file diff --git a/maintenance/pages-and-stars.md b/maintenance/pages-and-stars.md index 9ff7ae6..677ca85 100644 --- a/maintenance/pages-and-stars.md +++ b/maintenance/pages-and-stars.md @@ -1,6 +1,6 @@ # Pages and observed GitHub stars -This repository publishes its site from the independent `site-data` branch. `main` CI produces development artifacts. It does not deploy them. +Verified releases use the independent `site-data` branch. `main` CI produces development artifacts. **Preview Pages** (`preview-pages.yml`) may be dispatched manually from `main` to build, check and deploy the current source without a release receipt. A preview is not a verified release, does not update `site-data` or star history, and may be replaced by a later preview or verified release. Deploying it replaces the site currently served at the public Pages URL until another deployment succeeds. ## Publish a released site diff --git a/tools/site/build.mjs b/tools/site/build.mjs index c6fa4e1..e226e18 100644 --- a/tools/site/build.mjs +++ b/tools/site/build.mjs @@ -68,7 +68,7 @@ export function prepare(repo) { cleanUrls: true, outDir: path.join(repo, 'dist/site'), cacheDir: path.join(repo, 'dist/site-cache'), appearance: true, lastUpdated: false, locales: { root: { label: 'English', lang: 'en', themeConfig: { nav: nav('') } }, zh: { label: '简体中文', lang: 'zh-Hans', themeConfig: { nav: nav('zh/'), outlineTitle: '本页内容', returnToTopLabel: '返回顶部', sidebarMenuLabel: '目录', darkModeSwitchLabel: '外观' } } }, - themeConfig: { releaseVersion: config.version, outline: [2, 3], socialLinks: [{ icon: 'github', link: `https://github.com/shendeguize/${role}` }], footer: { message: 'Philosophy · methods · grounds / 哲学 · 方法 · 根据', copyright: 'MIT · Organon' } }, + themeConfig: { releaseVersion: config.version, preview: process.env.ORGANON_SITE_PREVIEW === 'true', outline: [2, 3], socialLinks: [{ icon: 'github', link: `https://github.com/shendeguize/${role}` }], footer: { message: 'Philosophy · methods · grounds / 哲学 · 方法 · 根据', copyright: 'MIT · Organon' } }, vite: { resolve: { preserveSymlinks: true } } }; write(path.join(source, '.vitepress/config.mjs'), `export default ${JSON.stringify(vp, null, 2)};\n`); diff --git a/tools/site/theme/Layout.vue b/tools/site/theme/Layout.vue index 2463cb4..e1ea8b0 100644 --- a/tools/site/theme/Layout.vue +++ b/tools/site/theme/Layout.vue @@ -6,9 +6,11 @@ const { site, lang } = useData(); const route = useRoute(); const router = useRouter(); const chinese = computed(() => lang.value.startsWith('zh')); -const edition = computed(() => /-rc\./.test(site.value.themeConfig.releaseVersion) - ? (chinese.value ? '候选发行版 · 等待审核' : 'Release candidate · awaiting review') - : (chinese.value ? '正式发行版' : 'Stable release')); +const edition = computed(() => site.value.themeConfig.preview + ? (chinese.value ? '源码预览 · 非发行版' : 'Source preview · not a release') + : /-rc\./.test(site.value.themeConfig.releaseVersion) + ? (chinese.value ? '候选发行版 · 等待审核' : 'Release candidate · awaiting review') + : (chinese.value ? '正式发行版' : 'Stable release')); const peer = computed(() => { const base = site.value.base; const path = route.path.slice(base.length).replace(/^zh\//, ''); diff --git a/zh/maintenance/pages-and-stars.md b/zh/maintenance/pages-and-stars.md index 4227ab0..cd0d7ff 100644 --- a/zh/maintenance/pages-and-stars.md +++ b/zh/maintenance/pages-and-stars.md @@ -1,6 +1,6 @@ # Pages 与 GitHub 星标实测 -本仓库从独立的 `site-data` 分支发布站点。`main` CI 生成开发产物,不部署这些产物。 +已验证发行版使用独立的 `site-data` 分支。`main` CI 生成开发产物。可以从 `main` 手动运行 **Preview Pages**(`preview-pages.yml`),构建并检查当前源码后直接部署,但不生成发行收据。预览站点不是已验证发行版,不更新 `site-data` 或星标历史,并可被后续预览或已验证发行版替换。部署预览会替换 Pages 公开地址当前提供的站点,直至另一次部署成功。 ## 发布已发行站点