Repository navigation
53 lines (47 loc) · 1.54 KB
/
Copy pathwf-update-version.yaml
File metadata and controls
53 lines (47 loc) · 1.54 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
name: wf_update_version
run-name: Update Version
on:
workflow_call:
inputs:
bumpVersion:
description: "The version to bump to"
type: string
default: bump-build
userName:
description: "The user name to use for the commit"
type: string
default: ${{ github.event.pusher.name }}
userEmail:
description: "The user email to use for the commit"
type: string
default: ${{ github.event.pusher.email }}
jobs:
update_version:
name: Update Version
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
sparse-checkout: src
- name: Get tagged branch
if: ${{ github.ref_type == 'tag' }}
run: |
tag=${{ github.ref_name }}
sha=$(git rev-list -n 1 $tag)
branch=$(git branch -r --contains $sha | cut -c3- | sed 's/origin\///')
git checkout $branch
- name: Bump Version
id: bump_version_prefix
uses: vers-one/dotnet-project-version-updater@v1.5
with:
file: "**/src/*.csproj"
version: ${{ inputs.bumpVersion }}
- name: Push new VersionPrefix
run: |
git config user.name "${{inputs.userName}}"
git config user.email "${{inputs.userEmail}}"
git add .
git commit -m "Update Version Prefix from ${{ steps.bump_version_prefix.outputs.oldVersion }} to ${{ steps.bump_version_prefix.outputs.newVersion }}"
git push