Skip to content

Commit

Permalink
Create dotnet.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
G2Pavon authored and lewa-j committed Jul 27, 2024
1 parent 723bf8e commit e364813
Showing 1 changed file with 84 additions and 0 deletions.
84 changes: 84 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -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 }}

0 comments on commit e364813

Please sign in to comment.