diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..8ee0b3e --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,63 @@ +name: Build PixelWorld binaries + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + workflow_dispatch: + +jobs: + build: + strategy: + matrix: + include: + - os: ubuntu-latest + runtime: linux-x64 + artifact-name: pixelworld-linux-x64 + - os: ubuntu-latest + runtime: linux-arm64 + artifact-name: pixelworld-linux-arm64 + - os: windows-latest + runtime: win-x64 + artifact-name: pixelworld-win-x64 + - os: windows-latest + runtime: win-arm64 + artifact-name: pixelworld-win-arm64 + - os: macos-latest + runtime: osx-x64 + artifact-name: pixelworld-osx-x64 + - os: macos-latest + runtime: osx-arm64 + artifact-name: pixelworld-osx-arm64 + + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.0.x' + + - name: Restore dependencies + run: dotnet restore + + - name: Build + run: dotnet build --configuration Release --no-restore + + - name: Test + run: dotnet test --configuration Release --no-build --verbosity normal + + - name: Publish + run: | + dotnet publish ./CommandLine/CommandLine.csproj --configuration Release --runtime ${{ matrix.runtime }} --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:DebugType=None -p:DebugSymbols=false --output ./publish/${{ matrix.artifact-name }} + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.artifact-name }} + path: ./publish/${{ matrix.artifact-name }} + retention-days: 90 \ No newline at end of file diff --git a/CommandLine/Program.cs b/CommandLine/Program.cs index 32adc51..03f5291 100644 --- a/CommandLine/Program.cs +++ b/CommandLine/Program.cs @@ -17,7 +17,7 @@ private static void Main(string[] args) app.Configure(config => { config.SetApplicationName("pw.exe"); - config.SetApplicationVersion("0.10"); + config.SetApplicationVersion(typeof(Program).Assembly.GetName().Version?.ToString(3) ?? "Unknown"); AddCommands(config); }); diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..483aa3b --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,9 @@ + + + + 0.5.0 + $(Version) + $(Version) + $(Version) + + diff --git a/PixelWorld.sln b/PixelWorld.sln index 021bc2b..b8f0f85 100644 --- a/PixelWorld.sln +++ b/PixelWorld.sln @@ -10,6 +10,7 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{986EA84F-9F5D-4D8D-9B72-F79C53DEFBA9}" ProjectSection(SolutionItems) = preProject .editorconfig = .editorconfig + Directory.Build.props = Directory.Build.props EndProjectSection EndProject Global