-
Notifications
You must be signed in to change notification settings - Fork 3
77 lines (73 loc) · 2.29 KB
/
build.yml
File metadata and controls
77 lines (73 loc) · 2.29 KB
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
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: .NET Build and Release
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore --configuration Release
- name: Publish
run: dotnet publish --configuration Release --output ./publish --runtime ${{ matrix.os == 'ubuntu-latest' && 'linux-x64' || matrix.os == 'windows-latest' && 'win-x64' || 'osx-x64' }} --self-contained true
- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.os }}
path: publish
create_release:
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download Linux artifact
uses: actions/download-artifact@v4
with:
name: dist-ubuntu-latest
path: dist-linux
- name: Download Windows artifact
uses: actions/download-artifact@v4
with:
name: dist-windows-latest
path: dist-windows
- name: Download macOS artifact
uses: actions/download-artifact@v4
with:
name: dist-macos-latest
path: dist-macos
- name: Zip Releases
run: |
zip -r release-linux.zip dist-linux
zip -r release-windows.zip dist-windows
zip -r release-macos.zip dist-macos
- name: Create Release and Upload Assets
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
with:
tag_name: v${{ github.run_number }}
name: Release ${{ github.run_number }}
body: |
Automated release for commit ${{ github.sha }}
draft: false
prerelease: false
files: |
release-linux.zip
release-windows.zip
release-macos.zip