|
| 1 | +name: Create release from /master |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ master ] |
| 6 | + |
| 7 | +jobs: |
| 8 | + build: |
| 9 | + runs-on: ubuntu-latest |
| 10 | + steps: |
| 11 | + - uses: actions/checkout@v2 |
| 12 | + - name: Setup .NET Core |
| 13 | + uses: actions/setup-dotnet@v1 |
| 14 | + with: |
| 15 | + dotnet-version: 3.1.100 |
| 16 | + - name: Run Tests |
| 17 | + run: dotnet test src/SoundFingerprinting.Tests/SoundFingerprinting.Tests.csproj -c Release -v n |
| 18 | + - name: Slack Failure Notification |
| 19 | + if: failure() |
| 20 | + uses: rtCamp/action-slack-notify@v2.0.0 |
| 21 | + env: |
| 22 | + SLACK_COLOR: '#3278BD' |
| 23 | + SLACK_MESSAGE: 'SoundFingerprinting core library build failed on master branch' |
| 24 | + SLACK_USERNAME: rtCamp |
| 25 | + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} |
| 26 | + - name: Define Variables |
| 27 | + run: | |
| 28 | + cat src/SoundFingerprinting/SoundFingerprinting.csproj | grep PackageVersion | awk -F">" '{print $2}' | awk -F"<" '{print $1}' > SF_CORE_VERSION |
| 29 | + echo "##[set-output name=sf_core_version;]$(cat SF_CORE_VERSION)" |
| 30 | + id: define_variables |
| 31 | + - name: Create Release |
| 32 | + id: create_release |
| 33 | + uses: actions/create-release@v1 |
| 34 | + env: |
| 35 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 36 | + with: |
| 37 | + tag_name: v${{ steps.define_variables.outputs.sf_core_version }} |
| 38 | + release_name: Release ${{ steps.define_variables.outputs.sf_core_version }} |
| 39 | + draft: false |
| 40 | + prerelease: false |
| 41 | + - name: Slack Success Notification |
| 42 | + uses: rtCamp/action-slack-notify@v2.0.0 |
| 43 | + env: |
| 44 | + SLACK_COLOR: '#3278BD' |
| 45 | + SLACK_MESSAGE: 'SoundFingerprinting core library GitHub release created' |
| 46 | + SLACK_USERNAME: rtCamp |
| 47 | + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} |
| 48 | + publish-nuget: |
| 49 | + needs: build |
| 50 | + runs-on: ubuntu-latest |
| 51 | + steps: |
| 52 | + - uses: actions/checkout@master |
| 53 | + - name: Setup .NET Core |
| 54 | + uses: actions/setup-dotnet@v1 |
| 55 | + with: |
| 56 | + dotnet-version: 3.1.101 |
| 57 | + - name: Publish to NuGet |
| 58 | + uses: rohith/publish-nuget@v2 |
| 59 | + with: |
| 60 | + PROJECT_FILE_PATH: src/SoundFingerprinting/SoundFingerprinting.csproj # Relative to repository root |
| 61 | + # VERSION_FILE_PATH: Directory.Build.props # Filepath with version info, relative to repository root. Defaults to project file |
| 62 | + VERSION_REGEX: <PackageVersion>(.*)<\/PackageVersion> # Regex pattern to extract version info in a capturing group |
| 63 | + TAG_COMMIT: false # Flag to enable / disalge git tagging |
| 64 | + # TAG_FORMAT: v* # Format of the git tag, [*] gets replaced with version |
| 65 | + NUGET_KEY: ${{ secrets.NUGET_API_KEY }} # nuget.org API key |
| 66 | + # PACKAGE_NAME: NuGet package name, required when it's different from project name. Defaults to project name |
| 67 | + - name: Slack Notification |
| 68 | + uses: rtCamp/action-slack-notify@v2.0.0 |
| 69 | + env: |
| 70 | + SLACK_COLOR: '#3278BD' |
| 71 | + SLACK_MESSAGE: 'SoundFingerprinting has been published to NuGet' |
| 72 | + SLACK_USERNAME: rtCamp |
| 73 | + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} |
| 74 | + |
0 commit comments