diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml new file mode 100644 index 0000000..d92127e --- /dev/null +++ b/.github/workflows/dotnet.yml @@ -0,0 +1,84 @@ +name: Build .NET Core 8.0 Binaries + +on: + push: + pull_request: + workflow_dispatch: + +permissions: + contents: write + +env: + DOTNET_TERM_COLOR: always + +jobs: + build: + strategy: + matrix: + os: [ubuntu-latest, windows-latest] + configuration: [Release] + include: + - os: ubuntu-latest + filename: osm2vmf + label: Ubuntu + runtime: linux-x64 + - os: windows-latest + filename: osm2vmf.exe + label: Windows + runtime: win-x64 + + name: ${{ matrix.label }} - ${{ matrix.configuration }} + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Install .NET Core + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.0.x + + - name: Restore dependencies + run: dotnet restore OSM_Parser.sln + + - name: Build + run: dotnet build OSM_Parser.sln --configuration ${{ matrix.configuration }} + + - name: Publish + run: dotnet publish OSM_Parser/OSM_Parser.csproj --configuration ${{ matrix.configuration }} --runtime ${{ matrix.runtime }} --output ./output + + - name: Prepare Linux Executable + if: matrix.os == 'ubuntu-latest' + run: | + mkdir -p osm2vmf + cp ./output/${{ matrix.filename }} osm2vmf/${{ matrix.filename }} + cp ./output/*.dll osm2vmf/ + cp ./output/*.runtimeconfig.json osm2vmf/ + + - name: Prepare Windows Executable + if: matrix.os == 'windows-latest' + run: | + mkdir osm2vmf + cp .\output\${{ matrix.filename }} osm2vmf\${{ matrix.filename }} + cp .\output\*.dll osm2vmf\ + cp .\output\*.runtimeconfig.json osm2vmf\ + + - name: Upload build artifacts + uses: actions/upload-artifact@v3 + with: + name: osm2vmf-${{ matrix.label }} + path: osm2vmf + + - name: Prepare Release + if: startsWith(github.ref, 'refs/tags/') && matrix.configuration == 'Release' + run: | + 7z a osm2vmf-${{ matrix.label }}.7z osm2vmf + + - name: Release + uses: softprops/action-gh-release@v2 + if: startsWith(github.ref, 'refs/tags/') && matrix.configuration == 'Release' + with: + files: osm2vmf-${{ matrix.label }}.7z + token: ${{ secrets.GITHUB_TOKEN }}