Skip to content

Commit

Permalink
Create dotnet.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
jewels86 authored Dec 10, 2024
1 parent 0f3ae95 commit c2c6346
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Build and Release

on:
push:
tags:
- 'v*' # Trigger on version tags like v1.0.0

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
os: [ubuntu-latest, windows-latest]
arch: [x64]

steps:
- name: Check out code
uses: actions/checkout@v2

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'

- name: Restore dependencies
run: dotnet restore

- name: Build self-contained executable
run: |
dotnet publish -c Release -r ${{ matrix.os }} --self-contained true /p:PublishTrimmed=true -o out/${{ matrix.os }}
- name: Upload Build Artifacts
uses: actions/upload-artifact@v3
with:
name: app-${{ matrix.os }}
path: out/${{ matrix.os }}

release:
needs: build
runs-on: ubuntu-latest

steps:
- name: Download Artifacts
uses: actions/download-artifact@v2
with:
name: app-${{ matrix.os }}
path: out

- name: Create GitHub Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: Release ${{ github.ref_name }}
draft: false
prerelease: false

- name: Upload Release Assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: out/${{ matrix.os }}/*
asset_name: ${{ matrix.os }}-app-${{ github.ref_name }}.zip
asset_content_type: application/zip

0 comments on commit c2c6346

Please sign in to comment.