-
Notifications
You must be signed in to change notification settings - Fork 7
88 lines (83 loc) · 2.58 KB
/
main.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
name: CICD
on:
push:
branches: [ "main" ]
concurrency:
group: "cicd"
cancel-in-progress: false
jobs:
build:
uses: ./.github/workflows/build.yml
with:
buildConfiguration: Release
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Create Release
id: create-release
uses: actions/github-script@v7
with:
script: |
const newVersion = '${{ needs.build.outputs.newVersion }}';
const response = await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: newVersion,
target_commitish: context.sha,
name: newVersion,
generate_release_notes: true
});
core.setOutput('upload_url', response.data.upload_url);
- name: Download Artifact Packages
uses: actions/download-artifact@v4
with:
name: packages
path: ./artifacts
- name: Attach Release Assets
uses: actions/github-script@v7
with:
script: |
const uploadUrl = '${{ steps.create-release.outputs.upload_url }}';
const fs = require('fs');
const path = require('path');
const packages = fs.readdirSync('./artifacts').filter(file => file.endsWith('.nupkg'));
for (const file of packages) {
const filePath = path.join('./artifacts', file);
const name = path.basename(filePath);
const response = await github.rest.repos.uploadReleaseAsset({
url: uploadUrl,
headers: {
'content-type': 'application/zip',
'content-length': fs.statSync(filePath).size
},
name: name,
data: fs.readFileSync(filePath)
});
core.info('Uploaded ' + name);
}
publish-docs:
permissions:
id-token: write
pages: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Dotnet Setup
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.x
- run: dotnet tool update -g docfx
- run: docfx ./docfx/docfx.json
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
# Upload entire repository
path: './docfx/_site'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4