Skip to content

Commit

Permalink
work on publishing the web demo
Browse files Browse the repository at this point in the history
  • Loading branch information
Ellpeck committed Sep 14, 2024
1 parent c4bd03f commit 4680144
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 24 deletions.
24 changes: 1 addition & 23 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,10 @@ jobs:
uses: android-actions/setup-android@v3
- name: Restore tools
run: dotnet tool restore
- name: Run cake
- name: Run Publish
uses: coactions/setup-xvfb@v1
with:
run: dotnet cake --target Publish --ref ${{ github.ref }} --buildNum ${{ github.run_number }}
env:
NUGET_KEY: ${{ secrets.NUGET_KEY }}
BAGET_KEY: ${{ secrets.BAGET_KEY }}
docs:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Restore tools
run: dotnet tool restore
- name: Run cake
run: dotnet cake --target Document --ref ${{ github.ref }} --buildNum ${{ github.run_number }}
- name: Deploy
if: startsWith(github.ref, 'refs/tags/')
# this is a beautiful way to deploy a website and i will not take any criticism
run: |
curl -L --output cloudflared.deb https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb && sudo dpkg -i cloudflared.deb
mkdir ~/.ssh && echo "${{ secrets.ELLBOT_KEY }}" > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa
rsync -rv --delete -e 'ssh -o "ProxyCommand cloudflared access ssh --hostname %h" -o "StrictHostKeyChecking=no"' Docs/_site/. ellbot@ssh.ellpeck.de:/var/www/MLEM
70 changes: 70 additions & 0 deletions .github/workflows/web.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
on: [push, pull_request]
jobs:
build-demo:
runs-on: windows-latest
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Restore tools
run: dotnet tool restore
- name: Run PublishWeb
run: dotnet cake --target PublishWeb --ref ${{ github.ref }} --buildNum ${{ github.run_number }}
- name: Upload demo artifact
uses: actions/upload-artifact@v4
with:
path: Demos.Web/bin/*/net*/publish/wwwroot
name: demo
build-docs:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Restore tools
run: dotnet tool restore
- name: Run Document
run: dotnet cake --target Document --ref ${{ github.ref }} --buildNum ${{ github.run_number }}
- name: Upload docs artifact
uses: actions/upload-artifact@v4
with:
path: Docs/_site
name: docs
deploy:
needs: [build-demo, build-docs]
runs-on: ubuntu-latest
steps:
- name: Download demo artifact
uses: actions/download-artifact@v4
with:
name: demo
- name: Download docs artifact
uses: actions/download-artifact@v4
with:
name: docs
- name: Combine sites
run: |
mv docs _site
mv demo _site/demo
- name: Upload combined artifact
uses: actions/upload-artifact@v4
with:
path: _site
name: site
- name: Deploy
if: startsWith(github.ref, 'refs/tags/')
# this is a beautiful way to deploy a website and i will not take any criticism
run: |
curl -L --output cloudflared.deb https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb && sudo dpkg -i cloudflared.deb
mkdir ~/.ssh && echo "${{ secrets.ELLBOT_KEY }}" > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa
rsync -rv --delete -e 'ssh -o "ProxyCommand cloudflared access ssh --hostname %h" -o "StrictHostKeyChecking=no"' _site/. ellbot@ssh.ellpeck.de:/var/www/MLEM
3 changes: 2 additions & 1 deletion Docs/docfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"**/MLEM**.csproj"
],
"exclude": [
"**.FNA.**"
"**.FNA.**",
"**.KNI.**"
]
}
],
Expand Down
7 changes: 7 additions & 0 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ Task("Document").Does(() => {
DocFxServe("Docs/_site");
});

Task("PublishWeb").Does(() => {
DotNetPublish("Demos.Web/Demos.Web.KNI.csproj", new DotNetPublishSettings {
Configuration = config,
ArgumentCustomization = args => args.Append($"/p:Version={version}")
});
});

Task("Default").IsDependentOn("Pack");
Task("Publish").IsDependentOn("Push");

Expand Down

0 comments on commit 4680144

Please sign in to comment.