Skip to content

Commit 5d31037

Browse files
committed
ci: add gha for tag release
Signed-off-by: Vitor Bandeira <vvbandeira@precisioninno.com>
1 parent a166175 commit 5d31037

1 file changed

Lines changed: 52 additions & 0 deletions

File tree

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Quarterly Release Tag
2+
3+
on:
4+
schedule:
5+
# Midnight UTC on the first day of each quarter (Jan, Apr, Jul, Oct)
6+
- cron: '0 0 1 1,4,7,10 *'
7+
workflow_dispatch:
8+
9+
concurrency:
10+
group: quarterly-tag
11+
cancel-in-progress: false
12+
13+
jobs:
14+
create-tag:
15+
name: Create quarterly tag
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: write
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
23+
- name: Determine tag name
24+
id: tag
25+
run: |
26+
month=$(date -u +%-m)
27+
year=$(date -u +%y)
28+
case $month in
29+
1|2|3) quarter=1 ;;
30+
4|5|6) quarter=2 ;;
31+
7|8|9) quarter=3 ;;
32+
10|11|12) quarter=4 ;;
33+
esac
34+
tag="${year}Q${quarter}"
35+
echo "tag=$tag" >> "$GITHUB_OUTPUT"
36+
echo "Quarterly tag: $tag"
37+
38+
- name: Configure git user
39+
run: |
40+
git config user.name "github-actions[bot]"
41+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
42+
43+
- name: Create and push tag
44+
env:
45+
TAG: ${{ steps.tag.outputs.tag }}
46+
run: |
47+
if git ls-remote --tags origin "refs/tags/$TAG" | grep -q .; then
48+
echo "Tag $TAG already exists, skipping."
49+
exit 0
50+
fi
51+
git tag --annotate "$TAG" -m "Quarterly release $TAG"
52+
git push origin "$TAG"

0 commit comments

Comments
 (0)