Skip to content

Commit b07123a

Browse files
authored
Add workflow to create tag based on .version file updates (#37)
* Add workflow to create tag based on .version file updates Signed-off-by: svrnm <neumanns@cisco.com> * add workflow dispatch trigger Signed-off-by: svrnm <neumanns@cisco.com> --------- Signed-off-by: svrnm <neumanns@cisco.com>
1 parent 77fc6b3 commit b07123a

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Create Tag from .version File
2+
permissions: read-all
3+
4+
on:
5+
workflow_dispatch:
6+
push:
7+
paths:
8+
- ".version" # Trigger only when the .version file changes
9+
10+
jobs:
11+
create_tag:
12+
runs-on: ubuntu-24.04
13+
14+
steps:
15+
# Checkout the repository
16+
- name: Checkout repository
17+
uses: actions/checkout@v4.2.2
18+
19+
# Read the content of the .version file
20+
- name: Read version from .version file
21+
id: read_version
22+
run: |
23+
if [ ! -f .version ]; then
24+
echo "The .version file does not exist."
25+
exit 1
26+
fi
27+
version=$(cat .version | tr -d '[:space:]')
28+
echo "version=$version" >> $GITHUB_ENV
29+
30+
# Create a tag with the version
31+
- name: Create and push tag
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.CISCO_SERVICE_GITHUB_AUTOMATION_TOKEN }}
34+
run: |
35+
git tag $version
36+
git push origin $version

0 commit comments

Comments
 (0)