Skip to content

Commit

Permalink
Merge pull request #281 from stride3d/master
Browse files Browse the repository at this point in the history
Initiating deployment of latest docs updates to staging
  • Loading branch information
VaclavElias authored May 5, 2024
2 parents 992050f + dc214c0 commit 9dcd493
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 12 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/common-setup.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Common Setup for Stride Documentation

# This is not used currently. The job runs in a separate instants so can't be used
on:
workflow_call:
outputs:
Expand All @@ -8,7 +9,7 @@ on:
value: ${{ jobs.setup.outputs.stride_docs_path }}
stride_path:
description: "The checkout path of the Stride repository"
value: ${{ jobs.setup.outputs.stride_path }}
value: ${{ jobs.setup.outputs.stride_path }}

jobs:
setup:
Expand Down
62 changes: 52 additions & 10 deletions .github/workflows/stride-docs-staging-azure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@

name: Build Stride Docs for Azure Web App Staging

env:
COMMON_SETTINGS_PATH: en/docfx.json
VERSION: "2.0.0.${{ github.run_number }}"
DOCS_PATH: stride-docs

on:
push:
branches:
Expand All @@ -17,23 +22,60 @@ on:
workflow_dispatch:

jobs:
setup:
uses: ./.github/workflows/common-setup.yml

build:
# Run this job only if the repository is 'stride3d/stride-docs'
if: github.repository == 'stride3d/stride-docs'
runs-on: windows-2022

needs: setup

steps:
- name: .NET SDK Setup
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x

# Checkout the Stride Docs repository from the branch that triggered the workflow
- name: Checkout Stride Docs
uses: actions/checkout@v4
with:
path: ${{ env.DOCS_PATH }}
lfs: true

- name: Set Version in docfx.json
run: |
$settingsContent = Get-Content -Path "${{ env.DOCS_PATH }}/${{ env.COMMON_SETTINGS_PATH }}" -Raw
$updatedDocFxJsonContent = $settingsContent -replace '2.0.0.x', "${{ env.VERSION }}"
Set-Content -Path "${{ env.DOCS_PATH }}/${{ env.COMMON_SETTINGS_PATH }}" -Value $updatedDocFxJsonContent
shell: pwsh

- name: Display Updated docfx.json
run: cat "${{ env.DOCS_PATH }}/${{ env.COMMON_SETTINGS_PATH }}"
shell: pwsh

- name: Fail the Workflow
run: exit 1
shell: pwsh

# Checkout the Stride repository from the default branch
- name: Checkout Stride (note the LFS)
uses: actions/checkout@v4
with:
repository: stride3d/stride
token: ${{ secrets.GITHUB_TOKEN }}
path: stride
lfs: true

- name: Install DocFX
# This installs the latest version of DocFX and may introduce breaking changes
# run: dotnet tool update -g docfx
# This installs a specific, tested version of DocFX.
run: dotnet tool update -g docfx --version 2.76.0

- name: Build documentation
run: ./build-all.bat
working-directory: ${{ needs.setup.outputs.stride_docs_path }}
working-directory: ${{ env.DOCS_PATH }}

- name: Compress artifact
run: 7z a -r DocFX-app.zip ./${{ needs.setup.outputs.stride_docs_path }}/_site/*
run: 7z a -r DocFX-app.zip ./${{ env.DOCS_PATH }}/_site/*

- name: Upload artifact for deployment job
uses: actions/upload-artifact@v4
Expand All @@ -45,7 +87,7 @@ jobs:
if: github.repository == 'stride3d/stride-docs'
runs-on: windows-2022

needs: [build, setup]
needs: build
environment:
name: 'Production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
Expand All @@ -60,7 +102,7 @@ jobs:
# run: ls

- name: Decompress artifact
run: 7z x DocFX-app.zip "-o./stride-docs/_site"
run: 7z x DocFX-app.zip "-o./${{ env.DOCS_PATH }}/_site"

- name: Deploy to Azure Web App
id: deploy-to-webapp
Expand All @@ -69,4 +111,4 @@ jobs:
app-name: 'stride-doc'
slot-name: 'staging'
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_32FCD402B970463A9143B24C9B225749 }}
package: ./stride-docs/_site
package: ./${{ env.DOCS_PATH }}/_site
2 changes: 1 addition & 1 deletion en/docfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"_enableSearch": true,
"_appLogoPath": "media/stride-logo-red.svg",
"_appLogoUrl": "https://www.stride3d.net/",
"_appFooter": "<div class=\"d-flex flex-column flex-sm-row justify-content-between pt-1 text-center small\"><p >Supported by the <a href=\"https://dotnetfoundation.org/\" target=\"_blank\" rel=\"noopener\">.NET Foundation</a></p><p>Made with <a href=\"https://dotnet.github.io/docfx\">docfx</a></p><p >Stride Docs Website v.2.0.0.12</p><p>&copy; .NET Foundation and Contributors</p></div>",
"_appFooter": "<div class=\"d-flex flex-column flex-sm-row justify-content-between pt-1 text-center small\"><p >Supported by the <a href=\"https://dotnetfoundation.org/\" target=\"_blank\" rel=\"noopener\">.NET Foundation</a></p><p>Made with <a href=\"https://dotnet.github.io/docfx\">docfx</a></p><p >Stride Docs Website v.2.0.0.x</p><p>&copy; .NET Foundation and Contributors</p></div>",
"_gitContribute": {
"repo": "https://github.com/stride3d/stride-docs",
"branch": "master"
Expand Down

0 comments on commit 9dcd493

Please sign in to comment.