-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (85 loc) · 2.64 KB
/
dotnet.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: Build and Release
on:
push:
tags:
- 'v*' # Trigger on version tags like v1.0.0
jobs:
build-linux:
runs-on: ubuntu-latest # GitHub runner for Linux
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Restore dependencies
run: dotnet restore
- name: Build self-contained executable for Linux
run: |
dotnet publish -c Release -r linux-x64 --self-contained -o out/linux-x64
- name: Upload Build Artifacts
uses: actions/upload-artifact@v3
with:
name: app-linux
path: out/linux-x64
build-windows:
runs-on: windows-latest # GitHub runner for Windows
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Restore dependencies
run: dotnet restore
- name: Build self-contained executable for Windows
run: |
dotnet publish -c Release -r win-x64 --self-contained -o out/win-x64
- name: Upload Build Artifacts
uses: actions/upload-artifact@v3
with:
name: app-windows
path: out/win-x64
release:
needs: [build-linux, build-windows]
runs-on: ubuntu-latest # Release job runs on Linux runner
steps:
- name: Download Linux Artifacts
uses: actions/download-artifact@v3
with:
name: app-linux
path: out
- name: Download Windows Artifacts
uses: actions/download-artifact@v3
with:
name: app-windows
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 Linux 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/linux-x64/*
asset_name: linux-app-${{ github.ref_name }}.zip
asset_content_type: application/zip
- name: Upload Windows 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/win-x64/*
asset_name: windows-app-${{ github.ref_name }}.zip
asset_content_type: application/zip