Skip to content

Commit

Permalink
Add workflow to create tag based on .version file updates (#37)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
svrnm authored Dec 17, 2024
1 parent 77fc6b3 commit b07123a
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/tag-from-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Create Tag from .version File
permissions: read-all

on:
workflow_dispatch:
push:
paths:
- ".version" # Trigger only when the .version file changes

jobs:
create_tag:
runs-on: ubuntu-24.04

steps:
# Checkout the repository
- name: Checkout repository
uses: actions/checkout@v4.2.2

# Read the content of the .version file
- name: Read version from .version file
id: read_version
run: |
if [ ! -f .version ]; then
echo "The .version file does not exist."
exit 1
fi
version=$(cat .version | tr -d '[:space:]')
echo "version=$version" >> $GITHUB_ENV
# Create a tag with the version
- name: Create and push tag
env:
GITHUB_TOKEN: ${{ secrets.CISCO_SERVICE_GITHUB_AUTOMATION_TOKEN }}
run: |
git tag $version
git push origin $version

0 comments on commit b07123a

Please sign in to comment.