-
Notifications
You must be signed in to change notification settings - Fork 38
36 lines (36 loc) · 1.02 KB
/
tag_release.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
33
34
35
36
name: Tag Release
on:
push:
branches:
- prod-stable
jobs:
tag_release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: prod-stable
- run: |
git fetch --prune --unshallow
- name: Tag this release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
DATE=$(date +"%Y.%m.%d")
PREV_RELEASE=$(git tag --list | tail -1)
MINOR_VERSION=0
case $PREV_RELEASE in
*"$DATE"*)
MINOR_VERSION="$PREV_RELEASE" | cut -d'.' -f5
MINOR_VERSION=$((MINOR_VERSION+1))
;;
*)
MINOR_VERSION=0
;;
esac
TAG="r.$DATE.$MINOR_VERSION"
git config --local user.email "cost-mgmt@redhat.com"
git config --local user.name "Cost Management Release Action"
git log $(git tag --list | tail -1)..prod-stable | git tag -a $TAG -F -
git push origin $TAG
shell: bash