Skip to content

Commit f972cfb

Browse files
committed
ci: use a Github actions to publish the Web app
1 parent 1f28254 commit f972cfb

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

.github/workflows/publish.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ jobs:
2929
version: 8
3030

3131
- name: Publish
32-
run: |
33-
git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/glutinum-org/cli.git
34-
./build.sh publish --web-only
32+
uses: peaceiris/actions-gh-pages@v3
33+
with:
34+
github_token: ${{ secrets.GITHUB_TOKEN }}
35+
publish_dir: ./src/Glutinum.Web/dist

src/Glutinum.Build/Commands/Publish.fs

+8-11
Original file line numberDiff line numberDiff line change
@@ -301,19 +301,16 @@ type PublishCommand() =
301301
if settings.IsWebOnly then
302302
Web.WebCommand().Execute(context, Web.WebSettings()) |> ignore
303303

304-
if Environment.GetEnvironmentVariable("CI") = "true" then
305-
Command.Run(
306-
"npx",
307-
"gh-pages -d ./src/Glutinum.Web/dist/ -u \"github-actions-bot <[email protected]>\""
308-
)
309-
else
304+
// If we are not in a CI environment, we can publish the web app
305+
// Otherwise, we want to let the CI handle it
306+
if Environment.GetEnvironmentVariable("CI") = null then
310307
Command.Run("npx", "gh-pages -d ./src/Glutinum.Web/dist/")
311308

312-
// Reset the changes to the Prelude file, as we only needed it for the publish
313-
Command.Run(
314-
"git",
315-
"checkout HEAD -- src/Glutinum.Converter/Prelude.fs"
316-
)
309+
// Reset the changes to the Prelude file, as we only needed it for the publish
310+
Command.Run(
311+
"git",
312+
"checkout HEAD -- src/Glutinum.Converter/Prelude.fs"
313+
)
317314

318315
0
319316
else if Seq.isEmpty releaseContext.ReleaseCommits then

0 commit comments

Comments
 (0)