-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (85 loc) · 2.79 KB
/
cd.yml
File metadata and controls
102 lines (85 loc) · 2.79 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: CD
on:
push:
tags:
- "v*.*.*"
env:
DOTNET_VERSION: "9.0"
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
pages: write
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Install CMake
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: "3.20"
- name: Install cpp
run: sudo apt-get update && sudo apt-get install -y gcc
- name: Restore dotnet tools
run: dotnet tool restore
- name: Configure CMake
run: cmake -B build -DCMAKE_BUILD_TYPE=Release
- name: Extract version from tag
id: get_version
run: |
VERSION=${GITHUB_REF#refs/tags/v}
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "Extracted version: $VERSION"
- name: Update project version
run: |
sed -i "s/<Version>.*<\/Version>/<Version>${{ steps.get_version.outputs.VERSION }}<\/Version>/" OpenLanguage/OpenLanguage.csproj
- name: Build and package
run: |
cmake --build build --target process
cmake --build build --target build
cmake --build build --target pack
- name: Generate documentation
run: |
cmake --build build --target doc
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: Release ${{ steps.get_version.outputs.VERSION }}
draft: false
prerelease: false
generate_release_notes: true
files: |
build/packages/*.nupkg
overwrite_files: true
make_latest: true
fail_on_unmatched_files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to NuGet
run: |
dotnet nuget push build/packages/*.nupkg \
--source https://api.nuget.org/v3/index.json \
--api-key ${{ secrets.NUGET_API_KEY }} \
--skip-duplicate
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
- name: Deploy documentation to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: build/docs/site
destination_dir: archive/${{ steps.get_version.outputs.VERSION }}
- name: Update latest docs symlink
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: build/docs/site
destination_dir: docs