-
Notifications
You must be signed in to change notification settings - Fork 209
76 lines (72 loc) · 3.17 KB
/
Copy pathcreate-release.yml
File metadata and controls
76 lines (72 loc) · 3.17 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
name: Create release from /master
on:
push:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
container: mcr.microsoft.com/dotnet/sdk:10.0
steps:
- uses: actions/checkout@v3
- name: Read Package Version
id: define_variables
run: |
VERSION=$(sed -n 's/.*<Version>\(.*\)<\/Version>.*/\1/p' src/Directory.Build.props)
echo "sf_core_version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Ensure Version Was Bumped
run: |
if git ls-remote --exit-code --tags origin "refs/tags/v${{ steps.define_variables.outputs.sf_core_version }}" > /dev/null; then
echo "::error::v${{ steps.define_variables.outputs.sf_core_version }} is already released. Run ./bump.sh on develop before merging to master."
exit 1
fi
- name: Run Tests
run: dotnet test src/SoundFingerprinting.Tests/SoundFingerprinting.Tests.csproj -c Release -v n -tl:off
- name: Slack Failure Notification
if: failure()
uses: rtCamp/action-slack-notify@v2
env:
SLACK_COLOR: '#3278BD'
SLACK_MESSAGE: 'SoundFingerprinting Core library release failed on master branch (missing version bump or failing tests, check logs)'
SLACK_USERNAME: rtCamp
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.define_variables.outputs.sf_core_version }}
release_name: Release ${{ steps.define_variables.outputs.sf_core_version }}
draft: false
prerelease: false
- name: Slack Success Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_COLOR: '#3278BD'
SLACK_MESSAGE: 'SoundFingerprinting v${{ steps.define_variables.outputs.sf_core_version }} core library GitHub release created'
SLACK_USERNAME: rtCamp
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
publish-nuget:
needs: build
runs-on: ubuntu-latest
container: mcr.microsoft.com/dotnet/sdk:10.0
steps:
- uses: actions/checkout@master
- name: Publish to NuGet
uses: alirezanet/publish-nuget@v3.0.3
with:
PROJECT_FILE_PATH: src/SoundFingerprinting/SoundFingerprinting.csproj # Relative to repository root
VERSION_FILE_PATH: src/Directory.Build.props # Filepath with version info, relative to repository root
VERSION_REGEX: <Version>(.*)<\/Version> # Regex pattern to extract version info in a capturing group
TAG_COMMIT: false # Flag to enable / disalge git tagging
# TAG_FORMAT: v* # Format of the git tag, [*] gets replaced with version
NUGET_KEY: ${{ secrets.NUGET_API_KEY }} # nuget.org API key
# PACKAGE_NAME: NuGet package name, required when it's different from project name. Defaults to project name
INCLUDE_SYMBOLS: false # do not publish symbols
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_COLOR: '#3278BD'
SLACK_MESSAGE: 'SoundFingerprinting has been published to NuGet'
SLACK_USERNAME: rtCamp
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}