-
Notifications
You must be signed in to change notification settings - Fork 29
64 lines (63 loc) · 2 KB
/
ci.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
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
id: build
run: |
VERSION=$(sed -nr 's/^.*const string version.*"(.*)".*$/\1/pi' ./RockSniffer/Program.cs)
echo "Sniffer version: $VERSION"
echo "SNIFFER_VERSION=$VERSION" >> "$GITHUB_OUTPUT"
dotnet build --configuration Release --no-restore
- name: Publish
env:
SNIFFER_VERSION: ${{ steps.build.outputs.SNIFFER_VERSION }}
run: |
dotnet publish RockSniffer -c Release -o ./publish --runtime win-x64 --framework=net6.0-windows --self-contained false -p:PublishSingleFile=true
cp -r ./addons ./publish/addons
(cd ./publish && zip -r "$OLDPWD/RockSniffer $SNIFFER_VERSION.zip" .)
echo "$SNIFFER_VERSION" > VERSION
- uses: actions/upload-artifact@v3
with:
name: RockSniffer-release
path: |
VERSION
./RockSniffer ${{ steps.build.outputs.SNIFFER_VERSION }}.zip
release:
runs-on: ubuntu-latest
needs:
- build
permissions:
contents: write
steps:
- uses: actions/download-artifact@v3
with:
name: RockSniffer-release
- name: Get version
id: get-version
run: |
echo "SNIFFER_VERSION=$(cat VERSION)" >> "$GITHUB_OUTPUT"
- uses: ncipollo/release-action@v1
with:
name: v${{ steps.get-version.outputs.SNIFFER_VERSION }}
tag: v${{ steps.get-version.outputs.SNIFFER_VERSION }}
allowUpdates: true
updateOnlyUnreleased: true
commit: ${{ github.sha }}
prerelease: true
draft: true
generateReleaseNotes: true
artifacts: "*.zip"