From 7cbde5364448b6aa6d10c7e88ea8b842afa71f2f Mon Sep 17 00:00:00 2001 From: Dylan Perks Date: Thu, 23 Jan 2025 20:50:58 +0000 Subject: [PATCH] Add a website 3.0 workflow --- .github/workflows/publish-site.yml | 36 ++++++++++++++++++++++++++++++ eng/build/Build.Website.cs | 12 ++++------ eng/submodules/silk.net-2.x | 2 +- 3 files changed, 41 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/publish-site.yml diff --git a/.github/workflows/publish-site.yml b/.github/workflows/publish-site.yml new file mode 100644 index 0000000000..8b2e0b7b32 --- /dev/null +++ b/.github/workflows/publish-site.yml @@ -0,0 +1,36 @@ +name: Website Build +on: + push: + branches: + - 'feature/website-3.0' + pull_request: +permissions: + contents: read + pages: write + id-token: write + +jobs: + Build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Build Website + run: | + git submodule update --init --recommend-shallow eng/submodules/silk.net-2.x + ./build.sh website + - name: Upload artifact + if: ${{ github.repository == 'dotnet/Silk.NET' && github.ref == 'refs/heads/develop/3.0' }} + uses: actions/upload-pages-artifact@v1 + with: + path: "artifacts/docs/Silk.NET" + Deploy: + if: ${{ github.repository == 'dotnet/Silk.NET' && github.ref == 'refs/heads/develop/3.0' }} + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: Build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v1 diff --git a/eng/build/Build.Website.cs b/eng/build/Build.Website.cs index fdf063280b..93a89ff12f 100644 --- a/eng/build/Build.Website.cs +++ b/eng/build/Build.Website.cs @@ -27,9 +27,6 @@ readonly record struct VersionDescription( AbsolutePath? Changelog = null ); - // From oldest to newest. Last one is current. - const bool IsCurrentVersionPreview = true; - [Parameter("If enabled, skips scraping the contributors for the authors.yml file of the blog.")] readonly bool SkipContributorsScrape; @@ -107,13 +104,12 @@ await GetAuthorsContents().ToListAsync() } jsonVersions[i == versions.Length - 1 ? "current" : version.Name] = new JsonVersion( - version.Changelog is { } changelog - ? GetVersionFromChangelog(changelog) + version.Changelog is { } changelog ? GetVersionFromChangelog(changelog) : File.Exists(version.Path / "version.txt") ? File.ReadAllText(version.Path / "version.txt") - : Git($"describe --tags --abbrev=0", version.Path) - .First(x => x.Type == OutputType.Std) - .Text.Trim(), + : Git($"describe --tags --abbrev=0", version.Path) + .First(x => x.Type == OutputType.Std) + .Text.Trim(), i == versions.Length - 1 ? version.Name : null ); } diff --git a/eng/submodules/silk.net-2.x b/eng/submodules/silk.net-2.x index c260024656..ca36450946 160000 --- a/eng/submodules/silk.net-2.x +++ b/eng/submodules/silk.net-2.x @@ -1 +1 @@ -Subproject commit c26002465633ece9582746cc95d2e081150b4f2d +Subproject commit ca364509467f0fb40af40f7ed040b4c63670a4c6