Skip to content

Update build.yml

Update build.yml #20

Workflow file for this run

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