-
Notifications
You must be signed in to change notification settings - Fork 1k
73 lines (60 loc) · 1.97 KB
/
Copy pathrelease.yml
File metadata and controls
73 lines (60 loc) · 1.97 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
name: Release
on:
push:
tags: ['v*']
permissions: {}
jobs:
build:
runs-on: windows-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.x'
- name: Parse version from tag
id: version
shell: pwsh
env:
TAG: ${{ github.ref_name }}
run: |
$version = $env:TAG.TrimStart('v')
$parts = $version -split '-', 2
$prefix = $parts[0]
$suffix = if ($parts.Length -gt 1) { $parts[1] } else { '' }
"prefix=$prefix" >> $env:GITHUB_OUTPUT
"suffix=$suffix" >> $env:GITHUB_OUTPUT
- name: Restore
run: dotnet restore --locked-mode
- name: Build
env:
VERSION_PREFIX: ${{ steps.version.outputs.prefix }}
VERSION_SUFFIX: ${{ steps.version.outputs.suffix }}
run: dotnet build ExcelDataReader.slnx --no-restore -c Release /p:TreatWarningsAsErrors=true /p:VersionPrefix=$env:VERSION_PREFIX /p:VersionSuffix=$env:VERSION_SUFFIX
- name: Test
run: dotnet test src/ExcelDataReader.Tests/ExcelDataReader.Tests.csproj --no-build -c Release
- name: Upload packages
uses: actions/upload-artifact@v7
with:
name: packages
path: '**/*.nupkg'
draft-release:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download packages
uses: actions/download-artifact@v8
with:
name: packages
path: packages
- name: Create draft release
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ github.ref_name }}
run: |
if [[ "$TAG" == *-* ]]; then PRERELEASE="--prerelease"; else PRERELEASE=""; fi
gh release create "$TAG" --repo "$GITHUB_REPOSITORY" --draft --generate-notes --title "$TAG" $PRERELEASE $(find packages -name '*.nupkg')