-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (46 loc) · 1.67 KB
/
build.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
name: prs-build
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: windows-latest # For a list of available runner types, refer to
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on
env:
Solution_Name: PRS.sln
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
# Install the .NET Core workload
- name: Install .NET 8.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
# Restore the application to populate the obj folder with RuntimeIdentifiers
- name: Build the application
run: dotnet build -c Release
# Execute all unit tests in the solution
#- name: Execute unit tests
# run: dotnet test
- name: Increase revision number
run: |
xml_file="./src/prs.csproj"
package_version=$(grep -oPm1 "(?<=<PackageVersion>)[^<]+" $xml_file)
echo "Current PackageVersion: $package_version"
IFS='.' read -r pmajor pminor pbuild prevision <<< "$package_version"
prevision=$((prevision + 1))
new_package_version="$pmajor.$pminor.$pbuild.$prevision"
echo "New PackageVersion: $new_package_version"
sed -i "s/<PackageVersion>.*<\/PackageVersion>/<PackageVersion>$new_package_version<\/PackageVersion>/" $xml_file
echo "Revision updated."
git config user.name "prs"
git config user.email ""
git add .
git commit -m "Update revision number to $new_package_version"
git push
echo "Revision numner update completed."
shell: bash