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 2 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
33 changes: 33 additions & 0 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: "Weekly Date Tag"

on:
schedule:
# Runs at 00:00 UTC every Sunday
- cron: '0 0 * * 0'

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

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

- name: Create and push tag
uses: actions/github-script@v7
with:
script: |
const github = require('@actions/github');
const core = require('@actions/core');
const exec = require('@actions/exec');
async function run() {
try {
const date = new Date();
const tag = `${date.getUTCFullYear()}.${String(date.getUTCMonth() + 1).padStart(2, '0')}.${String(date.getUTCDate()).padStart(2, '0')}`;
await exec.exec(`git tag ${tag}`);
await exec.exec(`git push origin ${tag}`);
} catch (error) {
core.setFailed(error.message);
}
}
run();