Weekly tag #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright © Michal Čihař <[email protected]> | |
# | |
# SPDX-License-Identifier: MIT | |
# | |
name: Weekly tag | |
on: | |
schedule: | |
- cron: 0 10 * * 0 | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
tag: | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: 🏷️ Create/update tag | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const now = Date.now(); | |
const onejan = new Date(now.getFullYear(), 0, 1); | |
/* This is not a ISO-8601 week number but works well for versioning */ | |
const week = Math.ceil((((now.getTime() - onejan.getTime()) / 86400000) + onejan.getDay() + 1) / 7); | |
github.rest.git.createRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: `refs/tags/v${ now.fullYear() }.${ week }`, | |
sha: context.sha | |
}) |