From 3fc42143d5a994a41ccd750100ecfe5752fe7c34 Mon Sep 17 00:00:00 2001 From: Ell Date: Sat, 14 Sep 2024 11:37:06 +0200 Subject: [PATCH] Added web demo to the website (#24) * work on publishing the web demo * some fixes * link to web demo --- .github/workflows/main.yml | 24 +----------- .github/workflows/web.yml | 78 ++++++++++++++++++++++++++++++++++++++ Docs/docfx.json | 3 +- Docs/toc.yml | 2 + README.md | 2 +- build.cake | 7 ++++ 6 files changed, 91 insertions(+), 25 deletions(-) create mode 100644 .github/workflows/web.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d2387681..01573228 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 diff --git a/.github/workflows/web.yml b/.github/workflows/web.yml new file mode 100644 index 00000000..bcb214ea --- /dev/null +++ b/.github/workflows/web.yml @@ -0,0 +1,78 @@ +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/Release/net8.0/publish/wwwroot + name: demo + include-hidden-files: true + if-no-files-found: error + 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 + include-hidden-files: true + if-no-files-found: error + deploy: + needs: [build-demo, build-docs] + runs-on: ubuntu-latest + steps: + - name: Download demo artifact + uses: actions/download-artifact@v4 + with: + name: demo + path: demo + - name: Download docs artifact + uses: actions/download-artifact@v4 + with: + name: docs + path: 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 + include-hidden-files: true + if-no-files-found: error + - 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 diff --git a/Docs/docfx.json b/Docs/docfx.json index eadf6c26..1547d344 100644 --- a/Docs/docfx.json +++ b/Docs/docfx.json @@ -8,7 +8,8 @@ "**/MLEM**.csproj" ], "exclude": [ - "**.FNA.**" + "**.FNA.**", + "**.KNI.**" ] } ], diff --git a/Docs/toc.yml b/Docs/toc.yml index 2ed53ee3..fc09c150 100644 --- a/Docs/toc.yml +++ b/Docs/toc.yml @@ -6,3 +6,5 @@ href: api/ - name: Changelog href: ../CHANGELOG.md +- name: Web Demo + href: demo/ diff --git a/README.md b/README.md index 0ca7c08e..00097cd1 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ MLEM is platform-agnostic and multi-targets .NET Standard 2.0, .NET 8.0 and .NET - Get prerelease builds on [BaGet](https://nuget.ellpeck.de/?q=mlem) - See the source code on [GitHub](https://github.com/Ellpeck/MLEM) - See tutorials and API documentation on [the website](https://mlem.ellpeck.de/) -- Check out [the demos](https://github.com/Ellpeck/MLEM/tree/main/Demos) on [Desktop](https://github.com/Ellpeck/MLEM/tree/main/Demos.DesktopGL) or [Android](https://github.com/Ellpeck/MLEM/tree/main/Demos.Android) +- Check out [the demos](https://github.com/Ellpeck/MLEM/tree/main/Demos) on [Desktop](https://github.com/Ellpeck/MLEM/tree/main/Demos.DesktopGL), [Android](https://github.com/Ellpeck/MLEM/tree/main/Demos.Android) or [Web](https://mlem.ellpeck.de/demo) - See [the changelog](https://mlem.ellpeck.de/CHANGELOG.html) for information on updates - Join [the Discord server](https://link.ellpeck.de/discordweb) to ask questions diff --git a/build.cake b/build.cake index caae07cb..77822bd6 100644 --- a/build.cake +++ b/build.cake @@ -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");