Repository navigation
151 lines (126 loc) · 4.98 KB
/
Copy pathrelease-stable.yml
File metadata and controls
151 lines (126 loc) · 4.98 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: Release - Stable
on:
release:
types: [published]
concurrency:
group: ${{ github.workflow }}-${{ github.event.release.id }}
cancel-in-progress: true
jobs:
publish:
# Only process releases from develop branch
if: github.event.release.target_commitish == 'develop'
runs-on: ubuntu-latest
permissions:
contents: read
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: '1'
DOTNET_CLI_TELEMETRY_OPTOUT: '1'
steps:
- name: Checkout tag
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.release.tag_name }}
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
- name: Extract and validate release version
run: |
TAG="${{ github.event.release.tag_name }}"
echo "Release tag: $TAG"
# Remove 'v' prefix if present
if [[ "$TAG" =~ ^v[0-9] ]]; then
VERSION="${TAG#v}"
else
echo "::error ::Tag must start with 'v' followed by version number (e.g., v1.2.3)"
exit 1
fi
# Validate it's a proper release version (X.Y.Z format, no suffix)
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "::error ::Invalid release version format. Expected X.Y.Z (e.g., 1.2.3), got: $VERSION"
exit 1
fi
echo "Using release version: $VERSION"
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
- name: Restore dependencies
run: dotnet restore
working-directory: ./src
- name: Build solution (stable)
run: dotnet build -c Release --no-restore -p:Version=${{ env.RELEASE_VERSION }} -p:AssemblyVersion=${{ env.RELEASE_VERSION }} -p:FileVersion=${{ env.RELEASE_VERSION }}
working-directory: ./src
- name: Run tests
run: dotnet test -c Release --no-build --no-restore --verbosity normal
working-directory: ./src
- name: Pack NuGet packages (stable)
run: dotnet pack -c Release --no-restore /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg -o ../artifacts -p:Version=${{ env.RELEASE_VERSION }}
working-directory: ./src
- name: Ensure packages exist
run: |
shopt -s nullglob
files=(artifacts/*.nupkg artifacts/*.snupkg)
(( ${#files[@]} )) || { echo "::error ::No packages found in artifacts/"; exit 1; }
- name: Upload artifacts (audit)
uses: actions/upload-artifact@v4
with:
name: packages-${{ env.RELEASE_VERSION }}
path: artifacts
retention-days: 7
- name: Push to NuGet.org
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: |
shopt -s nullglob
for p in artifacts/*.nupkg artifacts/*.snupkg; do
dotnet nuget push "$p" --source https://api.nuget.org/v3/index.json --api-key "$NUGET_API_KEY" --skip-duplicate
done
deploy-docs:
name: Deploy Documentation
needs: [publish]
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout tag
uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install dependencies
working-directory: website
run: npm ci
- name: Build VitePress
working-directory: website
run: npx vitepress build
- name: Extract docs version
id: docs-version
run: |
TAG="${{ github.event.release.tag_name }}"
VERSION="${TAG#v}"
MAJOR=$(echo "$VERSION" | cut -d. -f1)
MINOR=$(echo "$VERSION" | cut -d. -f2)
echo "value=v${MAJOR}.${MINOR}" >> $GITHUB_OUTPUT
- name: Package
run: cd website/.vitepress/dist && zip -r $GITHUB_WORKSPACE/docs.zip .
- name: Upload to Shelf
env:
KEY: ${{ secrets.SHELF_API_KEY }}
URL: ${{ secrets.SHELF_BASE_URL }}
VER: ${{ steps.docs-version.outputs.value }}
run: |
echo "Deploying capabilities docs $VER to $URL"
curl -f -X POST \
-H "Authorization: Bearer $KEY" \
-H "Content-Type: application/zip" \
--data-binary @$GITHUB_WORKSPACE/docs.zip \
"${URL}/api/products/capabilities/versions/${VER}"
- name: Docs deployment summary
run: |
echo "### Documentation Deployed" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Product:** capabilities" >> $GITHUB_STEP_SUMMARY
echo "**Version:** ${{ steps.docs-version.outputs.value }}" >> $GITHUB_STEP_SUMMARY
echo "**URL:** ${{ secrets.SHELF_BASE_URL }}/capabilities/" >> $GITHUB_STEP_SUMMARY