Skip to content

Commit 44fce41

Browse files
authored
Add a GHA that create a git tag weekly (#2137)
1 parent ca7dba0 commit 44fce41

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

.github/workflows/publish.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ name: "Publish a flake to flakestry"
22
on:
33
push:
44
tags:
5-
- "v?[0-9]+.[0-9]+.[0-9]+"
6-
- "v?[0-9]+.[0-9]+"
5+
# This pattern matches tags in the format YYYY.MM.DD
6+
# It expects a four-digit year, followed by a two-digit month and day
7+
- "[0-9]{4}.[0-9]{2}.[0-9]{2}"
78
workflow_dispatch:
89
inputs:
910
tag:

.github/workflows/tag.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: "Weekly Date Tag"
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * 0'
6+
7+
jobs:
8+
tag-repo:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v4
14+
15+
- name: Create and push tag using current date
16+
run: |
17+
TAG_DATE=$(date -u "+%Y.%m.%d")
18+
if git rev-parse "$TAG_DATE" >/dev/null 2>&1; then
19+
echo "Tag $TAG_DATE already exists. Skipping tag creation."
20+
else
21+
git config user.name "github-actions"
22+
git config user.email "[email protected]"
23+
git tag $TAG_DATE
24+
git push origin $TAG_DATE
25+
fi

0 commit comments

Comments
 (0)