Skip to content

A GitHub Action tool to automatically create a new CalVer following YYYY.MM.DD and create git tags & GitHub Releases

License

Notifications You must be signed in to change notification settings

MicahWW/CalVer-Creation

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

CalVer Creation

Creates a new version based on the current day's date (default of UTC but can specify timezone) and will auto increment the build metadata field (the # after the '+') to ensure that a tag is not overwritten by accident. Having this ability to create unique tags and easily readable allows for fast paced projects to create multiple tags a day, with no overlap, to help trigger other workflows or other items.

Input parameters

Parameter Name Required? Type Default Value Description
prefix false string '' For setting/reading a prefix, typically 'v', in front of the generated version. SemVer standards don't allow it but it is commonly done.
timezone false string 'UTC' For the setting the timezone used. Valid timezones are those defined by pytz in Python, examples of such are America/Chicago, Europe/Amsterdam, UTC, etc.
push_tag false bool false For setting and pushing the generated tag to GitHub. If set to 'true' it requires that the github_token is set and has contents:write so it has permission to push.
publish_release false bool false For the publishing of a new GitHub release. If set to 'true' it requires that push_tag is set to true and github_token is set and has contents:write so it can publish.
github_token false string none The token used for any git operations.
set_build_metadata false bool true Toggles the feature of appending build metadata to the end of the version. If this is set to 'false' after the first run for a calendar day, all subsequent runs will fail as it would attempt to create/overwrite a tag that was created on the first run.

Workflow Outputs

Parameter Name Type Description
new_version string The newly generated version tag.

GitHub Workflow permissions

Both pushing a new tag and publishing a new release require the contents: write permission to be set. You can see an example of how this is set at the Create and push a new tag usage example.

Usage

Create and push a new tag

Use this example workflow if you want to:

  1. generate a new version string
  2. tag the commit the workflow was run on then push that tag to GitHub
name: Create and push a new tag

on:
  workflow_dispatch:
permissions:
  contents: write # required for pushing tags

jobs:
  test:
    runs-on: ubuntu-latest

    steps:
      - name: Create and push tag
        uses: MicahWW/CalVer-Creation@v1
        with:
          prefix: 'v'
          timezone: 'America/Chicago'
          push_tag: 'true'
          github_token: ${{ secrets.GITHUB_TOKEN }}

Create and push a new tag without build metadata

Use this example workflow if you want to:

  1. generate a new version string without build metadata
  2. tag the commit the workflow was run on then push that tag to GitHub
name: Create and push a new tag without build metadata

on:
  workflow_dispatch:
permissions:
  contents: write # required for pushing tags

jobs:
  test:
    runs-on: ubuntu-latest

    steps:
      - name: Create and push tag
        uses: MicahWW/CalVer-Creation@v1
        with:
          set_build_metadata: 'false'
          prefix: 'v'
          timezone: 'America/Chicago'
          push_tag: 'true'
          github_token: ${{ secrets.GITHUB_TOKEN }}

Publish a new release & tag

Use this example workflow if you want to:

  1. generate a new version string
  2. tag the commit the workflow was run on then push that tag to GitHub
  3. generate a release based on the new tag pushed
name: Publish a new release & tag

on:
  workflow_dispatch:
permissions:
  contents: write # required for pushing tags & publishing releases

jobs:
  test:
    runs-on: ubuntu-latest

    steps:
      - name: Publish release and tag
        uses: MicahWW/CalVer-Creation@v1
        with:
          prefix: 'v'
          timezone: 'America/Chicago'
          push_tag: 'true'
          publish_release: 'true'
          github_token: ${{ secrets.GITHUB_TOKEN }}

About

A GitHub Action tool to automatically create a new CalVer following YYYY.MM.DD and create git tags & GitHub Releases

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •  

Languages