Skip to content

[GitHub Actions] Delete .pdb files as well. #3

[GitHub Actions] Delete .pdb files as well.

[GitHub Actions] Delete .pdb files as well. #3

name: Cross-Platform Build and Release
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
platform: [linux-x64, win-x64, osx-x64, osx-arm64]
include:
- net_version: "net8.0"
steps:
# Checkout the repository
- name: Checkout code
uses: actions/checkout@v3
# Setup .NET SDK
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.x'
# Create directories for the build outputs
- name: Create release directories
run: mkdir -p bin/${{ matrix.platform }}
# Publish ThirtyDollarConverter.GUI project
- name: Publish ThirtyDollarConverter.GUI
run: |
dotnet publish ./ThirtyDollarConverter.GUI/ThirtyDollarConverter.GUI.csproj \
-c Release -r ${{ matrix.platform }} \
--self-contained true \
-p:PublishSingleFile=true \
-p:IncludeNativeLibrariesForSelfExtract=true \
-o ./bin/${{ matrix.platform }}/ThirtyDollarConverterGUI
# Publish ThirtyDollarVisualizer project
- name: Publish ThirtyDollarVisualizer
run: |
dotnet publish ./ThirtyDollarVisualizer/ThirtyDollarVisualizer.csproj \
-c Release -r ${{ matrix.platform }} \
--self-contained true \
-p:PublishSingleFile=true \
-p:IncludeNativeLibrariesForSelfExtract=true \
-o ./bin/${{ matrix.platform }}/ThirtyDollarVisualizer
# Clean up unnecessary files before zipping
- name: Clean up build artifacts
run: |
rm -rf ./bin/${{ matrix.platform }}/ThirtyDollarConverterGUI/*.dll ./bin/${{ matrix.platform }}/ThirtyDollarConverterGUI/*.dylib ./bin/${{ matrix.platform }}/ThirtyDollarConverterGUI/*.so ./bin/${{ matrix.platform }}/ThirtyDollarConverterGUI/*.pdb ./bin/${{ matrix.platform }}/ThirtyDollarConverterGUI/runtimes
rm -rf ./bin/${{ matrix.platform }}/ThirtyDollarVisualizer/*.dll ./bin/${{ matrix.platform }}/ThirtyDollarVisualizer/*.dylib ./bin/${{ matrix.platform }}/ThirtyDollarVisualizer/*.so ./bin/${{ matrix.platform }}/ThirtyDollarVisualizer/runtimes
# Zip the executables of both projects together
- name: Zip both projects together
run: |
cd bin/${{ matrix.platform }}
zip -r ../${{ matrix.platform }}-release.zip ThirtyDollarConverterGUI ThirtyDollarVisualizer
# Upload the zipped release assets as artifacts
- name: Upload release artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.platform }}-release
path: bin/${{ matrix.platform }}-release.zip