Skip to content

Commit

Permalink
Update to latest
Browse files Browse the repository at this point in the history
  • Loading branch information
UnknownShadow200 committed Apr 28, 2024
1 parent 4f179de commit 84b4ba6
Show file tree
Hide file tree
Showing 20 changed files with 569 additions and 265 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 }}
2 changes: 1 addition & 1 deletion .github/actions/upload_build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ inputs:
runs:
using: "composite"
steps:
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: ${{ inputs.DEST_NAME }}
path: ${{ inputs.SOURCE_FILE }}
142 changes: 102 additions & 40 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,47 @@ concurrency:
cancel-in-progress: true

jobs:
build-mono:
#============================================
# ============== .NET 2.0 BUILD =============
# ===========================================
build-mono2:
if: github.ref_name == github.event.repository.default_branch
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Compile MCGalaxy using mono
shell: bash
id: compile
run: |
msbuild MCGalaxy.sln /p:Configuration=Release /p:TargetFrameworkVersion=v2.0 /p:DefineConstants="NET_20"
- uses: ./.github/actions/notify_failure
if: ${{ always() && steps.compile.outcome == 'failure' }}
with:
NOTIFY_MESSAGE: 'Failed to compile MCGalaxy .NET 2.0 build'
WEBHOOK_URL: '${{ secrets.WEBHOOK_URL }}'

- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'bin/Release'
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
steps:
- uses: actions/checkout@v4
- name: Compile MCGalaxy using mono
shell: bash
id: compile
Expand All @@ -36,94 +72,120 @@ 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

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
- 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'

# publish standalone windows binaries
- name: Publish-win64
run: dotnet publish CLI/MCGalaxyCLI_standalone6.csproj -r win-x64 --self-contained -p:ExtraConstants=MCG_STANDALONE

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

# publish standalone linux binaries
- name: Publish-linux64
run: dotnet publish CLI/MCGalaxyCLI_standalone6.csproj -r linux-x64 --self-contained -p:ExtraConstants=MCG_STANDALONE

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

# publish standalone macOS binaries
- name: Publish-mac64
run: dotnet publish CLI/MCGalaxyCLI_standalone6.csproj -r osx-x64 --self-contained -p:ExtraConstants=MCG_STANDALONE

- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'CLI/bin/Debug/net6.0/osx-x64/publish'
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

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- 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'

# publish standalone windows binaries
- name: Publish-win64
run: dotnet publish CLI/MCGalaxyCLI_dotnet8.csproj -r win-x64 --self-contained

- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile_net.outcome == 'success' }}
with:
SOURCE_FILE: 'CLI/bin/Release/net8.0/win-x64/publish'
DEST_NAME: 'MCGalaxy-win64-standalone'

# publish standalone linux binaries
- name: Publish-linux64
run: dotnet publish CLI/MCGalaxyCLI_dotnet8.csproj -r linux-x64 --self-contained

- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile_net.outcome == 'success' }}
with:
SOURCE_FILE: 'CLI/bin/Release/net8.0/linux-x64/publish'
DEST_NAME: 'MCGalaxy-linux64-standalone'

# publish standalone macOS binaries
- name: Publish-mac64
run: dotnet publish CLI/MCGalaxyCLI_dotnet8.csproj -r osx-x64 --self-contained

- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile_net.outcome == 'success' }}
- uses: ./.github/actions/notify_success
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'CLI/bin/Release/net8.0/osx-x64/publish'
DEST_NAME: 'MCGalaxy-mac64-standalone'
DESTINATION_URL: '${{ secrets.NOTIFY_URL }}'
WORKFLOW_NAME: 'net80'
134 changes: 134 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: Build release
on: [workflow_dispatch]

concurrency:
group: ${{ github.ref }}-release
cancel-in-progress: true

jobs:
build:
if: github.ref_name == github.event.repository.default_branch
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Retrieve supporting files
run: |
wget https://raw.githubusercontent.com/ClassiCube/MCGalaxy/master/sqlite3_x32.dll
wget https://raw.githubusercontent.com/ClassiCube/MCGalaxy/master/sqlite3_x64.dll
wget https://raw.githubusercontent.com/ClassiCube/MCGalaxy/master/MySql.Data.dll
- name: Retrieve .NET 2.0 binaries
run: |
mkdir net20
wget https://cdn.classicube.net/client/mcg/latest/net20/MCGalaxy_.dll -O net20/MCGalaxy_.dll
wget https://cdn.classicube.net/client/mcg/latest/net20/MCGalaxyCLI.exe -O net20/MCGalaxyCLI.exe
wget https://cdn.classicube.net/client/mcg/latest/net20/MCGalaxy.exe -O net20/MCGalaxy.exe
- name: Retrieve .NET 4.0 binaries
run: |
mkdir net40
wget https://cdn.classicube.net/client/mcg/latest/net40/MCGalaxy_.dll -O net40/MCGalaxy_.dll
wget https://cdn.classicube.net/client/mcg/latest/net40/MCGalaxyCLI.exe -O net40/MCGalaxyCLI.exe
wget https://cdn.classicube.net/client/mcg/latest/net40/MCGalaxy.exe -O net40/MCGalaxy.exe
- name: Retrieve .NET 4.0 (768 blocks) binaries
run: |
mkdir infid
wget https://cdn.classicube.net/client/mcg/latest/net40/MCGalaxy_infid.dll -O infid/MCGalaxy_.dll
wget https://cdn.classicube.net/client/mcg/latest/net40/MCGalaxyCLI.exe -O infid/MCGalaxyCLI.exe
wget https://cdn.classicube.net/client/mcg/latest/net40/MCGalaxy.exe -O infid/MCGalaxy.exe
- name: Retrieve standalone binaries
run: |
wget https://cdn.classicube.net/client/mcg/latest/mcg-win64-standalone.exe -O mcg-win64
wget https://cdn.classicube.net/client/mcg/latest/mcg-mac64-standalone -O mcg-mac64
wget https://cdn.classicube.net/client/mcg/latest/mcg-linux64-standalone -O mcg-linux64
- name: Generate builds
id: compile
shell: bash
run: |
make_dotnet_zip() {
cp sqlite3_x32.dll $1/sqlite3_x32.dll
cp sqlite3_x64.dll $1/sqlite3_x64.dll
cp MySql.Data.dll $1/MySql.Data.dll
zip -r $1.zip $1
}
make_standalone_tar() {
cp $1 MCGalaxy
chmod +x MCGalaxy
tar -zcvf $1.tar.gz MCGalaxy
}
make_standalone_zip() {
cp $1 MCGalaxy.exe
zip $1.zip MCGalaxy.exe sqlite3_x32.dll sqlite3_x64.dll
}
make_dotnet_zip net20
make_dotnet_zip net40
make_dotnet_zip infid
make_standalone_zip mcg-win64
make_standalone_tar mcg-mac64
make_standalone_tar mcg-linux64
find .
- uses: ./.github/actions/notify_failure
if: ${{ always() && steps.compile.outcome == 'failure' }}
with:
NOTIFY_MESSAGE: 'Failed to produce release'
WEBHOOK_URL: '${{ secrets.WEBHOOK_URL }}'


# Generate .NET release files
- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'net20.zip'
DEST_NAME: 'mcg-net20.zip'

- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'net40.zip'
DEST_NAME: 'mcg-net40.zip'

- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'infid.zip'
DEST_NAME: 'mcg-infid.zip'


# Generate standalone release files
- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'mcg-win64.zip'
DEST_NAME: 'mcg-win64.zip'

- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'mcg-mac64.tar.gz'
DEST_NAME: 'mcg-mac64.tar.gz'

- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'mcg-linux64.tar.gz'
DEST_NAME: 'mcg-linux64.tar.gz'


- uses: ./.github/actions/notify_success
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
DESTINATION_URL: '${{ secrets.NOTIFY_URL }}'
WORKFLOW_NAME: 'release'
1 change: 1 addition & 0 deletions CLI/MCGalaxyCLI_dotnet6.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<TargetFramework>net6.0</TargetFramework>
<PublishSingleFile>true</PublishSingleFile>
<PublishTrimmed>true</PublishTrimmed>
<DefineConstants>$(DefineConstants);$(ExtraConstants)</DefineConstants>
</PropertyGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit 84b4ba6

Please sign in to comment.