-
Notifications
You must be signed in to change notification settings - Fork 65
113 lines (94 loc) · 3.31 KB
/
stride-docs-release-azure.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions
name: Build Stride Docs for Azure Web App Release 🚀
env:
COMMON_SETTINGS_PATH: en/docfx.json
VERSION: "2.0.0.${{ github.run_number }}"
DOCS_PATH: stride-docs
on:
push:
branches:
- release
paths-ignore:
- 'README.md'
- 'Stride.Docs.sln'
- 'BuildDocs.ps1'
- 'wiki/**'
- .gitignore
- '.github/**'
workflow_dispatch:
jobs:
build:
# Run this job only if the repository is 'stride3d/stride-docs'
if: github.repository == 'stride3d/stride-docs'
runs-on: windows-2022
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
# 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.77.0
- name: Build documentation
run: ./build-all.bat
working-directory: ${{ env.DOCS_PATH }}
- name: Compress artifact
run: 7z a -r DocFX-app.zip ./${{ env.DOCS_PATH }}/_site/*
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v4
with:
name: DocFX-app
path: DocFX-app.zip
- name: Create GitHub Release
run: |
gh release create ${{ env.VERSION }} --title "v${{ env.VERSION }}" --notes "Release notes for ${{ env.VERSION }}" --draft
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
working-directory: ${{ env.DOCS_PATH }}
deploy:
if: github.repository == 'stride3d/stride-docs'
runs-on: windows-2022
needs: build
environment:
name: 'Production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v4
with:
name: DocFX-app
# - name: List current directory
# run: ls
- name: Decompress artifact
run: 7z x DocFX-app.zip "-o./${{ env.DOCS_PATH }}/_site"
- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: 'stride-doc'
slot-name: 'Production'
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_4803638D673FA67D0C8650F34C4FA9D1 }}
package: ./${{ env.DOCS_PATH }}/_site