-
Notifications
You must be signed in to change notification settings - Fork 4
104 lines (93 loc) · 2.91 KB
/
release.yml
File metadata and controls
104 lines (93 loc) · 2.91 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
name: Release NuGet Packages
on:
push:
tags:
- 'v*'
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
jobs:
publish:
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: write
outputs:
version: ${{ steps.version.outputs.VERSION }}
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Extract version from tag
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Pack solution
env:
VERSION: ${{ steps.version.outputs.VERSION }}
run: |
set -euo pipefail
dotnet pack DataProvider.sln -c Release \
-p:Version="$VERSION" \
-p:PackageVersion="$VERSION" \
-o ./nupkgs
- name: Push packages to NuGet
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: |
set -euo pipefail
if [ -z "${NUGET_API_KEY:-}" ]; then
echo "NUGET_API_KEY secret is not set." >&2
exit 1
fi
shopt -s nullglob
packages=(./nupkgs/*.nupkg)
if [ ${#packages[@]} -eq 0 ]; then
echo "No packages produced — failing." >&2
exit 1
fi
for pkg in "${packages[@]}"; do
echo "::group::Push $pkg"
dotnet nuget push "$pkg" \
--api-key "$NUGET_API_KEY" \
--source https://api.nuget.org/v3/index.json \
--skip-duplicate
echo "::endgroup::"
done
- name: Update version in Directory.Build.props
env:
VERSION: ${{ steps.version.outputs.VERSION }}
run: |
set -euo pipefail
sed -i 's|<Version>.*</Version>|<Version>'"$VERSION"'</Version>|' Directory.Build.props
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Directory.Build.props
git diff --cached --quiet || git commit -m "chore: bump version to $VERSION [skip ci]"
git push
- name: Create GitHub Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release create "${{ github.ref_name }}" --generate-notes
deploy-lql-website:
needs: publish
uses: ./.github/workflows/deploy-lql-website.yml
with:
version: ${{ needs.publish.outputs.version }}
permissions:
contents: read
pages: write
id-token: write
deploy-website:
needs: [publish, deploy-lql-website]
uses: ./.github/workflows/deploy-website.yml
with:
version: ${{ needs.publish.outputs.version }}
secrets: inherit
permissions:
contents: read
pages: write
id-token: write