generated from ne1410s/DemoLibrary
-
Notifications
You must be signed in to change notification settings - Fork 0
32 lines (32 loc) · 917 Bytes
/
new-tag.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
name: tag
on:
push:
branches:
- main
paths:
- source/**
workflow_dispatch: # todo: remove this demo trigger!
jobs:
tag:
runs-on: ubuntu-latest
steps:
- name: Install xmllint
run: sudo apt install libxml2-utils
- uses: actions/checkout@v4
with:
ssh-key: "${{ secrets.COMMIT_KEY }}"
- name: Set the version
run: |
shopt -s extglob
for file in ./source/**/!(*Test*(s)|*UnitTest*(s)).csproj; do
prefix="$(echo "cat /Project/PropertyGroup/VersionPrefix/text()" | xmllint --nocdata --shell "$file" | sed '1d;$d')"
if [[ $prefix ]]; then
break
fi
done
suffix="${{ format('pre.{0}', github.run_number) }}"
echo "VERSION=v${prefix:-1.0.0}-$suffix" >> $GITHUB_ENV
- name: Create tag
run: |
git tag ${{ env.VERSION }}
git push origin ${{ env.VERSION }}