Repository navigation
87 lines (75 loc) · 2.39 KB
/
Copy pathcd-docs.yml
File metadata and controls
87 lines (75 loc) · 2.39 KB
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
name: CD-Docs
on:
workflow_dispatch:
push:
tags:
- '**'
jobs:
build:
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- name: Find release tags
id: tags
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
for tag in $(gh api repos/Azure/iot-operations-sdks/releases -q '.[].tag_name'); do
if [[ $tag =~ (.*)/(.*)/(.*) ]]; then
lang=${BASH_REMATCH[1]}
package=${BASH_REMATCH[2]}
version=${BASH_REMATCH[3]}
if [[ $lang == "go" && -z ${go_tag} ]]; then
go_tag=$tag
elif [[ $lang == "dotnet" && -z ${dotnet_tag} ]]; then
dotnet_tag=$tag
fi
else
echo "Unknown tag: $tag"
fi
done
echo "go_tag=$go_tag" >> $GITHUB_OUTPUT
echo "dotnet_tag=$dotnet_tag" >> $GITHUB_OUTPUT
- name: Setup .NET
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6
with:
dotnet-version: 9.x
- name: Checkout Main
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
path: main
- name: Create index.html
run: |
mkdir _site
cp main/.github/pages/index.html _site
- name: Checkout Dotnet
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: ${{steps.tags.outputs.dotnet_tag}}
path: dotnet
- name: Build .NET docs
run: |
dotnet tool install -g docfx
cp main/.github/pages/docfx.json dotnet/.github/pages
cp main/.github/pages/filterConfig.yml dotnet/.github/pages
docfx dotnet/.github/pages/docfx.json
cp -a dotnet/.github/pages/_site _site/dotnet
- name: Upload to GitHub Pages
id: upload
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5
deploy:
permissions:
contents: read
pages: write
id-token: write
runs-on: ubuntu-latest
needs: build
environment:
name: github-pages
url: ${{steps.deployment.outputs.page_url}}
steps:
- name: Deploy artifact
id: deployment
uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5