-
Notifications
You must be signed in to change notification settings - Fork 11
96 lines (84 loc) · 3.14 KB
/
create-release.yml
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
name: Create new Release
on:
workflow_dispatch:
inputs:
versionIncrement:
description: 'The new version. For example: 1.1.0'
required: true
default: ''
prerelease:
description: 'Is this a pre-release?'
type: boolean
required: false
default: false
env:
VSTEST_CONNECTION_TIMEOUT: 180
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true
DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: 1
TERM: xterm
jobs:
release:
name: Publish new release
runs-on: ubuntu-latest
steps:
- name: Determine Version
id: version
run: |
if [ "${{ github.event.inputs.prerelease }}" = "true" ]; then
echo "version=${{ github.event.inputs.versionIncrement }}-preview" >> $GITHUB_OUTPUT
else
echo "version=${{ github.event.inputs.versionIncrement }}" >> $GITHUB_OUTPUT
fi
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT }}
persist-credentials: true
fetch-depth: 0
- name: Get changelog entries
id: changelog
uses: mindsers/changelog-reader-action@v2
with:
version: Unreleased
path: ./CHANGELOG.md
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
9.0.x
- name: Update CHANGELOG file
if: github.event.inputs.prerelease == 'false'
uses: thomaseizinger/keep-a-changelog-new-release@3.1.0
with:
version: ${{ github.event.inputs.versionIncrement }}
- name: Set git config
if: github.event.inputs.prerelease == 'false'
run: |
git config --local user.email "ncronjob-dev@action.com"
git config --local user.name "ncronjob-dev Bot"
- name: Commit changes and push changes
if: github.event.inputs.prerelease == 'false'
run: |
git add CHANGELOG.md
git commit -m "Update Changelog.md for ${{github.event.inputs.versionIncrement}} release"
git push origin main
- name: Create release on GitHub
if: github.event.inputs.prerelease == 'false'
uses: thomaseizinger/create-release@2.0.0
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
with:
tag_name: v${{ github.event.inputs.versionIncrement }}
target_commitish: ${{ env.RELEASE_COMMIT_HASH }}
name: v${{ github.event.inputs.versionIncrement }}
body: ${{ steps.changelog.outputs.changes }}
draft: false
- name: Create release package
run: |
dotnet pack -c RELEASE src/NCronJob/NCronJob.csproj -p:PackageVersion=${{ steps.version.outputs.version }} --property:PackageOutputPath=${GITHUB_WORKSPACE}/packages /p:ContinuousIntegrationBuild=true --nologo --include-symbols -p:SymbolPackageFormat=snupkg
- name: Upload to nuget
run: |
dotnet nuget push ${GITHUB_WORKSPACE}/packages/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate
dotnet nuget push ${GITHUB_WORKSPACE}/packages/*.snupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate