Skip to content

Commit

Permalink
Workflow notify
Browse files Browse the repository at this point in the history
  • Loading branch information
UnknownShadow200 committed Apr 28, 2024
1 parent 17e62f0 commit 191796c
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 13 deletions.
19 changes: 19 additions & 0 deletions .github/actions/notify_success/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Notify success
description: Sends a notification that a workflow has finished
inputs:
DESTINATION_URL:
description: 'Webhook notification URL'
type: string
WORKFLOW_NAME:
description: 'Workflow name'
required: true
type: string

runs:
using: "composite"
steps:
- name: Notify failure
if: ${{ inputs.DESTINATION_URL != '' }}
shell: sh
run: |
curl ${{ inputs.DESTINATION_URL }}/${{ inputs.WORKFLOW_NAME }}/${{ github.sha }}
65 changes: 52 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ concurrency:
cancel-in-progress: true

jobs:
#============================================
# ============== .NET 2.0 BUILD =============
# ===========================================
build-mono2:
if: github.ref_name == github.event.repository.default_branch
runs-on: ubuntu-latest
Expand All @@ -27,8 +30,18 @@ jobs:
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'bin/Release'
DEST_NAME: 'MCGalaxy_net2.0'
DEST_NAME: 'MCGalaxy_net2.0'

- uses: ./.github/actions/notify_success
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
DESTINATION_URL: '${{ secrets.NOTIFY_URL }}'
WORKFLOW_NAME: 'net20'


#============================================
# ============== .NET 4.0 BUILD =============
# ===========================================
build-mono4:
if: github.ref_name == github.event.repository.default_branch
runs-on: ubuntu-latest
Expand Down Expand Up @@ -59,9 +72,18 @@ jobs:
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'bin/Release'
DEST_NAME: 'MCGalaxy-infid'
DEST_NAME: 'MCGalaxy-infid'

- uses: ./.github/actions/notify_success
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
DESTINATION_URL: '${{ secrets.NOTIFY_URL }}'
WORKFLOW_NAME: 'net40'


#============================================
# ============== .NET 6.0 BUILD =============
# ===========================================
build-dotnet6:
if: github.ref_name == github.event.repository.default_branch
runs-on: ubuntu-latest
Expand All @@ -75,18 +97,18 @@ jobs:
- name: Restore dependencies
run: dotnet restore CLI/MCGalaxyCLI_dotnet6.csproj
- name: Build
id: compile_net
id: compile
run: |
dotnet build CLI/MCGalaxyCLI_dotnet6.csproj --no-restore
- uses: ./.github/actions/notify_failure
if: ${{ always() && steps.compile_net.outcome == 'failure' }}
if: ${{ always() && steps.compile.outcome == 'failure' }}
with:
NOTIFY_MESSAGE: 'Failed to compile MCGalaxy dotnet build'
WEBHOOK_URL: '${{ secrets.WEBHOOK_URL }}'

- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile_net.outcome == 'success' }}
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'CLI/bin/Debug/net6.0'
DEST_NAME: 'MCGalaxy-dotnet6.0'
Expand All @@ -96,7 +118,7 @@ jobs:
run: dotnet publish CLI/MCGalaxyCLI_dotnet6.csproj -r win-x64 --self-contained

- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile_net.outcome == 'success' }}
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'CLI/bin/Debug/net6.0/win-x64/publish'
DEST_NAME: 'MCGalaxy-win64-standalone'
Expand All @@ -106,7 +128,7 @@ jobs:
run: dotnet publish CLI/MCGalaxyCLI_dotnet6.csproj -r linux-x64 --self-contained

- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile_net.outcome == 'success' }}
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'CLI/bin/Debug/net6.0/linux-x64/publish'
DEST_NAME: 'MCGalaxy-linux64-standalone'
Expand All @@ -116,12 +138,22 @@ jobs:
run: dotnet publish CLI/MCGalaxyCLI_dotnet6.csproj -r osx-x64 --self-contained

- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile_net.outcome == 'success' }}
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'CLI/bin/Debug/net6.0/osx-x64/publish'
DEST_NAME: 'MCGalaxy-mac64-standalone'
DEST_NAME: 'MCGalaxy-mac64-standalone'


- uses: ./.github/actions/notify_success
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
DESTINATION_URL: '${{ secrets.NOTIFY_URL }}'
WORKFLOW_NAME: 'net60'


#============================================
# ============== .NET 8.0 BUILD =============
# ===========================================
build-dotnet8:
if: github.ref_name == github.event.repository.default_branch
runs-on: ubuntu-latest
Expand All @@ -135,18 +167,25 @@ jobs:
- name: Restore dependencies
run: dotnet restore CLI/MCGalaxyCLI_dotnet8.csproj
- name: Build
id: compile_net
id: compile
run: |
dotnet build CLI/MCGalaxyCLI_dotnet8.csproj --no-restore
- uses: ./.github/actions/notify_failure
if: ${{ always() && steps.compile_net.outcome == 'failure' }}
if: ${{ always() && steps.compile.outcome == 'failure' }}
with:
NOTIFY_MESSAGE: 'Failed to compile MCGalaxy dotnet build'
WEBHOOK_URL: '${{ secrets.WEBHOOK_URL }}'

- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile_net.outcome == 'success' }}
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'CLI/bin/Debug/net8.0'
DEST_NAME: 'MCGalaxy-dotnet8.0'
DEST_NAME: 'MCGalaxy-dotnet8.0'


- uses: ./.github/actions/notify_success
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
DESTINATION_URL: '${{ secrets.NOTIFY_URL }}'
WORKFLOW_NAME: 'net80'

0 comments on commit 191796c

Please sign in to comment.