-
Notifications
You must be signed in to change notification settings - Fork 0
152 lines (138 loc) · 5.1 KB
/
Copy pathreleaseBuild.yml
File metadata and controls
152 lines (138 loc) · 5.1 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
152
name: Build for release
on:
workflow_run:
workflows: [.NET CI]
types: [completed]
push:
tags:
- v*
jobs:
build_and_pack:
name: Release build & package
runs-on: ubuntu-24.04
timeout-minutes: 30
if: ${{ github.event_name == 'push' || github.event.workflow_run.conclusion == 'success' }}
env:
GithubNugetUsername: craigfowler
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
lfs: true
- name: Setup build dependencies
uses: ./.github/actions/setup-build-dependencies
- name: Restore third party libs
uses: ./.github/actions/restore-dependencies
- name: Build CI version
if: ${{ github.event_name == 'workflow_run' }}
run: dotnet pack -p:VersionSuffix=ci.${{ github.run_number }} -o packages
- name: Get semantic tag version
if: ${{ github.event_name == 'push' }}
id: get_version
run: |
tagname="${{ github.ref_name }}"
echo "name=${tagname:1}" >> "$GITHUB_OUTPUT"
shell: bash
- name: Build tagged version
if: ${{ github.event_name == 'push' }}
run: dotnet pack -p:Version=${{ steps.get_version.outputs.name }} -o packages
- name: Upload build result artifacts
uses: actions/upload-artifact@v7
with:
name: Build results (NuGet)
path: packages/*.nupkg
- name: Publish packages to GitHub feed
if: ${{ github.event_name != 'pull_request' && github.ref_name == 'master' }}
run: |
dotnet nuget add source --username ${{ env.GithubNugetUsername }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/csf-dev/index.json"
for package in packages/*.nupkg
do
dotnet nuget push $package --source github
done
build_docs_site:
name: Build the documentation website
runs-on: ubuntu-24.04
timeout-minutes: 30
if: ${{ github.event_name == 'push' || github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
lfs: true
- name: Setup build dependencies
uses: ./.github/actions/setup-build-dependencies
- name: Restore third party libs
uses: ./.github/actions/restore-dependencies
- name: Remove old docs
run: dotnet clean CSF.Screenplay.Docs
- name: Build docs website
run: dotnet build -c Docs CSF.Screenplay.Docs
- name: Upload docs website artifact
uses: actions/upload-artifact@v7
with:
name: Docs website
path: docs/**/*
publish_nuget:
name: Publish packages to NuGet
runs-on: ubuntu-slim
if: ${{ github.event_name == 'push' }}
needs: build_and_pack
permissions:
actions: read
id-token: write
contents: write
steps:
- name: Add .NET global tools location to PATH
run: echo "$HOME/.dotnet/tools" >> "$GITHUB_PATH"
shell: bash
- name: Install .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: 8.0.x
- name: Get release artifacts
uses: actions/download-artifact@v8
with:
name: Build results (NuGet)
path: ./packages
- name: Log into NuGet & get short-lived API key
uses: NuGet/login@v1
id: nuget-login
with:
user: ${{ secrets.NUGET_USER }}
- name: Publish to NuGet
run: dotnet nuget push ./packages/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ steps.nuget-login.outputs.NUGET_API_KEY }}
- name: Determine release properties
id: get-release-props
run: |
VERSION="${GITHUB_REF_NAME#v}"
PRERELEASE="$([[ "$VERSION" =~ "-" ]] && echo "true" || echo "false")"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "prerelease=$PRERELEASE" >> "$GITHUB_OUTPUT"
- name: Generate release notes (first part)
run: |
PACKAGE_LIST=$(for package in packages/*.nupkg; do echo $(basename "$package" | sed -r 's/^([A-Za-z.]+)\.[0-9.A-Za-z-]*\.nupkg$/\1/'); done)
VERSION="${{ steps.get-release-props.outputs.version }}"
cat <<EOF > release_notes.md
# CSF.Screenplay version $VERSION
## NuGet packages
These are the NuGet packages which are published for this release.
| Package | Version |
| ------- | ------- |
EOF
for package in $PACKAGE_LIST
do
echo "| [${package}](https://www.nuget.org/packages/${package}/${VERSION}) | $VERSION |" >> release_notes.md
done
cat <<EOF >> release_notes.md
## Changelog
EOF
- name: Create release
uses: softprops/action-gh-release@v3
with:
draft: true
name: ${{ steps.get-release-props.outputs.version }}
prerelease: ${{ steps.get-release-props.outputs.prerelease }}
body_path: release_notes.md
generate_release_notes: true