-
Notifications
You must be signed in to change notification settings - Fork 0
120 lines (102 loc) · 3.74 KB
/
Copy pathrelease.yml
File metadata and controls
120 lines (102 loc) · 3.74 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
name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., 1.0.0)'
required: true
type: string
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true
NUGET_DIRECTORY: ${{ github.workspace }}/nuget
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Get version
id: version
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
VERSION="${{ github.event.inputs.version }}"
else
VERSION=${GITHUB_REF#refs/tags/v}
fi
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "Version: $VERSION"
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --configuration Release --no-build --verbosity normal
- name: Pack
run: |
dotnet pack src/ModelingEvolution.Bytes/ModelingEvolution.Bytes.csproj \
--configuration Release \
/p:Version=${{ steps.version.outputs.VERSION }} \
/p:PackageReleaseNotes="See https://github.com/${{ github.repository }}/releases/tag/v${{ steps.version.outputs.VERSION }}" \
--output ${{ env.NUGET_DIRECTORY }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: nuget
if-no-files-found: error
retention-days: 7
path: ${{ env.NUGET_DIRECTORY }}/*.nupkg
- name: Publish to NuGet.org
run: |
for file in ${{ env.NUGET_DIRECTORY }}/*.nupkg
do
dotnet nuget push "$file" \
--api-key ${{ secrets.NUGET_API_KEY }} \
--source https://api.nuget.org/v3/index.json \
--skip-duplicate
done
- name: Publish to ModelingEvolution NuGet
run: |
dotnet nuget push "${{ env.NUGET_DIRECTORY }}/*.nupkg" \
--api-key ${{ secrets.NUGET_API_KEY_ME }} \
--source https://nuget.modelingevolution.com/v3/index.json \
--skip-duplicate
continue-on-error: true
- name: Publish to GitHub Packages
run: |
for file in ${{ env.NUGET_DIRECTORY }}/*.nupkg
do
dotnet nuget push "$file" \
--api-key ${{ secrets.GITHUB_TOKEN }} \
--source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json \
--skip-duplicate
done
- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
tag: v${{ steps.version.outputs.VERSION }}
name: Release v${{ steps.version.outputs.VERSION }}
body: |
## ModelingEvolution.Bytes v${{ steps.version.outputs.VERSION }}
### Installation
```bash
dotnet add package ModelingEvolution.Bytes --version ${{ steps.version.outputs.VERSION }}
```
### What's Changed
See [full changelog](https://github.com/${{ github.repository }}/compare/v${{ steps.version.outputs.VERSION }}...v${{ steps.version.outputs.VERSION }})
### NuGet Package
https://www.nuget.org/packages/ModelingEvolution.Bytes/${{ steps.version.outputs.VERSION }}
artifacts: ${{ env.NUGET_DIRECTORY }}/*.nupkg
draft: false
prerelease: false
allowUpdates: true
token: ${{ secrets.GITHUB_TOKEN }}