Skip to content

Add a GHA that create a git tag weekly #2137

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ name: "Publish a flake to flakestry"
on:
push:
tags:
- "v?[0-9]+.[0-9]+.[0-9]+"
- "v?[0-9]+.[0-9]+"
# This pattern matches tags in the format YYYY.MM.DD
# It expects a four-digit year, followed by a two-digit month and day
- "[0-9]{4}.[0-9]{2}.[0-9]{2}"
workflow_dispatch:
inputs:
tag:
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: "Weekly Date Tag"

on:
schedule:
- cron: '0 0 * * 0'

jobs:
tag-repo:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Create and push tag using current date
run: |
TAG_DATE=$(date -u "+%Y.%m.%d")
if git rev-parse "$TAG_DATE" >/dev/null 2>&1; then
echo "Tag $TAG_DATE already exists. Skipping tag creation."
else
git config user.name "github-actions"
git config user.email "[email protected]"
git tag $TAG_DATE
git push origin $TAG_DATE
fi