-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (56 loc) · 1.72 KB
/
create-release.yml
File metadata and controls
69 lines (56 loc) · 1.72 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
name: Create Release
on:
push:
tags:
- 'v*' # Trigger on version tags like v1.0.0
jobs:
build:
runs-on: ubuntu-latest
env:
PROJECT_NAME: SQLServerPing
strategy:
matrix:
rid: [win-x64, osx-x64, linux-x64] # runtime identifiers
name: Build for ${{ matrix.rid }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Set release filename
run: |
VERSION=${GITHUB_REF_NAME}
FILENAME="${{ env.PROJECT_NAME }}-${VERSION}-${{ matrix.rid }}.zip"
echo "FILENAME=$FILENAME" >> $GITHUB_ENV
- name: Publish self-contained app
run: |
dotnet publish -c Release -r ${{ matrix.rid }} --self-contained true -p:PublishSingleFile=true -o publish/${{ matrix.rid }}
- name: Archive binary
run: |
cd publish/${{ matrix.rid }}
zip -r ../../$FILENAME .
- name: Upload ZIP as artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.FILENAME }}
path: ${{ env.FILENAME }}
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Upload to GitHub Release
uses: softprops/action-gh-release@v1
with:
files: artifacts/**/*.zip # located in their own subdirs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}