Skip to content

Commit 5475e94

Browse files
committed
- Added auto-release code
1 parent 6f106d5 commit 5475e94

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

.github/workflows/auto-release.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Based on the Open-Source code from https://github.com/astrum-forge/sprint-tracker
2+
name: Auto Tag and Release
3+
on:
4+
schedule:
5+
- cron: '0 0 1,15 * *' # Runs at midnight on the 1st and 15th of every month
6+
permissions: write-all
7+
jobs:
8+
tag-and-release:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 0 # Fetch all history to access tags
15+
- name: Get current date
16+
id: date
17+
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
18+
- name: Determine new sprint number
19+
id: sprint
20+
run: |
21+
# List all numeric tags and find the highest number
22+
latest_sprint=$(git tag --list | grep -E '^[0-9]+$' | sort -n | tail -n 1)
23+
if [ -n "$latest_sprint" ]; then
24+
# Increment the latest sprint number
25+
new_sprint=$((latest_sprint + 1))
26+
else
27+
# Start with 193 if no numeric tags exist
28+
new_sprint=193
29+
fi
30+
echo "sprint=$new_sprint" >> $GITHUB_OUTPUT
31+
- name: Create new tag
32+
run: |
33+
git tag "${{ steps.sprint.outputs.sprint }}"
34+
git push origin "${{ steps.sprint.outputs.sprint }}"
35+
- name: Create release
36+
uses: ncipollo/release-action@v1
37+
with:
38+
tag: "${{ steps.sprint.outputs.sprint }}"
39+
name: "Sprint ${{ steps.sprint.outputs.sprint }}"
40+
body: |
41+
Sprint ${{ steps.sprint.outputs.sprint }}
42+
Date: ${{ steps.date.outputs.date }}
43+
draft: false
44+
prerelease: false

0 commit comments

Comments
 (0)