docs: add GitHub Pages repository README
Publish GitHub Pages output / publish (push) Successful in 47s
Publish GitHub Pages output / publish (push) Successful in 47s
This commit is contained in:
@@ -6,6 +6,7 @@ $ErrorActionPreference = 'Stop'
|
||||
|
||||
$projectRoot = Split-Path -Parent $PSScriptRoot
|
||||
$siteSource = Join-Path $projectRoot 'pages-dist'
|
||||
$readmeSource = Join-Path $projectRoot 'pages/README.md'
|
||||
$workflowSource = Join-Path $projectRoot 'pages/deploy.yml'
|
||||
$temporaryRoot = Join-Path ([System.IO.Path]::GetTempPath()) ("holodori-pages-{0}" -f [guid]::NewGuid().ToString('N'))
|
||||
$checkout = Join-Path $temporaryRoot 'repository'
|
||||
@@ -28,13 +29,14 @@ try {
|
||||
if (Test-Path -LiteralPath $oldSiteTarget) {
|
||||
Remove-Item -LiteralPath $oldSiteTarget -Recurse -Force
|
||||
}
|
||||
foreach ($generatedPath in @('assets', 'icons', 'index.html', 'README.txt', 'VERSION.txt', '.nojekyll')) {
|
||||
foreach ($generatedPath in @('assets', 'icons', 'index.html', 'README.md', 'README.txt', 'VERSION.txt', '.nojekyll')) {
|
||||
$target = Join-Path $resolvedCheckout $generatedPath
|
||||
if (Test-Path -LiteralPath $target) {
|
||||
Remove-Item -LiteralPath $target -Recurse -Force
|
||||
}
|
||||
}
|
||||
Copy-Item -Path (Join-Path $siteSource '*') -Destination $resolvedCheckout -Recurse -Force
|
||||
Copy-Item -LiteralPath $readmeSource -Destination (Join-Path $resolvedCheckout 'README.md') -Force
|
||||
New-Item -ItemType File -Path (Join-Path $resolvedCheckout '.nojekyll') -Force | Out-Null
|
||||
|
||||
$workflowTarget = Join-Path $resolvedCheckout '.github/workflows'
|
||||
|
||||
@@ -6,6 +6,7 @@ const htmlPath = path.join(output, 'index.html');
|
||||
const scriptPath = path.join(output, 'assets', 'app.js');
|
||||
const stylePath = path.join(output, 'assets', 'app.css');
|
||||
const packageJson = JSON.parse(await readFile(path.resolve('package.json'), 'utf8'));
|
||||
const isPagesBuild = path.basename(output) === 'pages-dist';
|
||||
|
||||
let html = await readFile(htmlPath, 'utf8');
|
||||
html = html.replace(/<script type="module" crossorigin src=/g, '<script defer src=');
|
||||
@@ -45,7 +46,15 @@ await writeFile(stylePath, style);
|
||||
await rm(path.join(output, 'data'), { recursive: true, force: true });
|
||||
|
||||
await writeFile(path.join(output, 'VERSION.txt'), `${packageJson.version}\n`);
|
||||
await writeFile(path.join(output, 'README.txt'), `홀로도리 계산기 ${packageJson.version}
|
||||
await writeFile(path.join(output, 'README.txt'), isPagesBuild
|
||||
? `홀로도리 계산기 ${packageJson.version}
|
||||
|
||||
서비스: https://doricalc-holo.live/
|
||||
|
||||
이 파일들은 GitHub Pages 배포용으로 자동 생성되었습니다.
|
||||
계산과 사용자 데이터 저장은 사용자의 브라우저에서 처리됩니다.
|
||||
`
|
||||
: `홀로도리 계산기 ${packageJson.version}
|
||||
|
||||
1. 압축파일의 내용을 모두 한 폴더에 풀어 주세요.
|
||||
2. index.html을 Chrome 또는 Edge로 열어 주세요.
|
||||
|
||||
@@ -7,6 +7,7 @@ import { fileURLToPath } from 'node:url';
|
||||
|
||||
const projectRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
||||
const siteSource = path.join(projectRoot, 'pages-dist');
|
||||
const readmeSource = path.join(projectRoot, 'pages', 'README.md');
|
||||
const repository = process.env.GITHUB_PAGES_REPOSITORY ?? 'https://github.com/DD4SN/DD4SN.github.io.git';
|
||||
|
||||
if (!process.env.GITHUB_PAGES_TOKEN) {
|
||||
@@ -48,9 +49,10 @@ try {
|
||||
|
||||
await requireGit(['clone', repository, checkout], { env: gitEnvironment });
|
||||
|
||||
const generatedPaths = ['site', 'assets', 'icons', 'index.html', 'README.txt', 'VERSION.txt', '.nojekyll'];
|
||||
const generatedPaths = ['site', 'assets', 'icons', 'index.html', 'README.md', 'README.txt', 'VERSION.txt', '.nojekyll'];
|
||||
await Promise.all(generatedPaths.map((generatedPath) => rm(path.join(checkout, generatedPath), { recursive: true, force: true })));
|
||||
await cp(siteSource, checkout, { recursive: true });
|
||||
await cp(readmeSource, path.join(checkout, 'README.md'));
|
||||
await writeFile(path.join(checkout, '.nojekyll'), '');
|
||||
|
||||
await requireGit(['config', 'user.name', 'HolodoriCalc deployment'], { cwd: checkout, env: gitEnvironment });
|
||||
|
||||
Reference in New Issue
Block a user