Skip to content

Commit 1cb26f6

Browse files
committed
relative
1 parent 6119372 commit 1cb26f6

File tree

4 files changed

+26
-21
lines changed

4 files changed

+26
-21
lines changed

Test/Verify.sh

+11
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,15 @@
3636
#fi
3737

3838
grep -i "base href=\"/$1/\"" _out/wwwroot/index.html > /dev/null
39+
40+
if [ $? -ne 0 ]; then
41+
echo index.html verify failed.
42+
exit 1
43+
fi
44+
3945
grep -i "/$1/?p=/" _out/wwwroot/404.html > /dev/null
46+
47+
if [ $? -ne 0 ]; then
48+
echo 404.html verify failed.
49+
exit 1
50+
fi

dist/index.js

+7-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.ts

+7-10
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,11 @@ async function main(): Promise<void> {
1717

1818
// Get Project path
1919
const projectPath = core.getInput('project-path', {required: true, trimWhitespace: true});
20-
const absoluteProjectPath = path.resolve(path.join('.', projectPath));
2120

2221
core.info(`Project Path: ${projectPath}`);
2322

2423
// Check project exists
25-
if (!fs.existsSync(absoluteProjectPath)) {
24+
if (!fs.existsSync(projectPath)) {
2625
core.setFailed(`The project '${projectPath}' not found.`);
2726
return;
2827
}
@@ -31,7 +30,7 @@ async function main(): Promise<void> {
3130
core.info('Restoring dependencies...');
3231

3332
try {
34-
await exec.exec(dotnet, ['restore', `"${absoluteProjectPath}"`]);
33+
await exec.exec(dotnet, ['restore', `"${projectPath}"`]);
3534
} catch (error: any) {
3635
core.setFailed(`Restore failed: ${error.message}`);
3736
return;
@@ -41,32 +40,30 @@ async function main(): Promise<void> {
4140
core.info('Building...');
4241

4342
try {
44-
await exec.exec(dotnet, ['build', `"${absoluteProjectPath}"`, '--no-restore', '-c', 'Release']);
43+
await exec.exec(dotnet, ['build', `"${projectPath}"`, '--no-restore', '-c', 'Release']);
4544
} catch (error: any) {
4645
core.setFailed(`Build failed: ${error.message}`);
4746
return;
4847
}
4948

5049
// Get Publish path
5150
const publishPath = core.getInput('publish-path');
52-
const absolutePublishPath = path.resolve(path.join('.', publishPath));
5351

5452
// Publish
5553
core.info('Publishing...');
5654

5755
try {
58-
await exec.exec(dotnet, ['publish', `"${absoluteProjectPath}"`, '--no-build', '-c', 'Release', '-o', `"${absolutePublishPath}"`]);
56+
await exec.exec(dotnet, ['publish', `"${projectPath}"`, '--no-build', '-c', 'Release', '-o', `"${publishPath}"`]);
5957
} catch (error: any) {
6058
core.setFailed(`Publish failed: ${error.message}`);
6159
return;
6260
}
6361

6462
// wwwroot
6563
const wwwroot = path.join(publishPath, 'wwwroot');
66-
const absolutewwwroot = path.join(absolutePublishPath, 'wwwroot');
6764

6865
// wwwroot exists
69-
if (!fs.existsSync(absolutewwwroot)) {
66+
if (!fs.existsSync(wwwroot)) {
7067
core.setFailed(`wwwroot directory not found`);
7168
return;
7269
}
@@ -78,13 +75,13 @@ async function main(): Promise<void> {
7875
if (context.repo.repo !== `${context.repo.owner}.github.io`) {
7976
core.info('Modifying index.html for this repository...');
8077

81-
const indexhtml = path.join(absolutewwwroot, 'index.html');
78+
const indexhtml = path.join(wwwroot, 'index.html');
8279
const indexFileContent = fs.readFileSync(indexhtml, 'utf8')
8380
.replaceAll('base href="/"', `base href="/${context.repo.repo}/"`);
8481

8582
fs.writeFileSync(indexhtml, indexFileContent);
8683

87-
const fourohfourhtml = path.join(absolutewwwroot, '404.html');
84+
const fourohfourhtml = path.join(wwwroot, '404.html');
8885

8986
if (fs.existsSync(fourohfourhtml)) {
9087
core.info('Modifying 404.html for this repository...');

0 commit comments

Comments
 (0)