Skip to content

GitHub Action to generate CalVer release

License

Notifications You must be signed in to change notification settings

cho0o0/calver-release-action

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 Release Action

CalVer

CalVer is a versioning convention based on your project's release calendar, instead of arbitrary numbers.

Source

Usage

Inputs

  • api_token (REQUIRED): GitHub token to be used for this action
  • dry_run (OPTIONAL): Whether to publish a release or just print supposed version (default: false)
  • generate_release_notes (OPTIONAL): Whether to generate release notes (default: true)
  • timezone (OPTIONAL): Timezone to be used for version generations (default: utc; example: Asia/Tokyo)
  • target_commitish (OPTIONAL): Target commitish to be used for release. The default value is SHA of current workflow context. (example: 78cb8a7/main)
  • release_title (OPTIONAL): Title format for the release. ${version} can be used and replaced as the generated version string. (default: Release ver. ${version}; example: New Release: ${version})

Outputs

  • version: Generated string of new version (currently only YYYY.0M.0D.MINOR is supported)
  • url: GitHub url for the published release
  • title: Generated string of the release title

Example

name: Publish

on:
  workflow_dispatch:
concurrency:
  publish_version
jobs:
  publish:
    runs-on: ubuntu-latest
    timeout-minutes: 30
    steps:
      - uses: actions/checkout@v3
      - uses: cho0o0/calver-release-action@2022.12.14.1
        with:
          generate_release_notes: true
          dry_run: false
          # Do not use GITHUB_TOKEN if you want to trigger other workflows
          timezone: 'utc'
          api_token: ${{secrets.GITHUB_TOKEN}}
          release_title: '${version}'

Development

First, you'll need to have a reasonably modern version of node handy. This won't work with versions older than 9, for instance.

Install the dependencies

$ npm install

Build the typescript and package it for distribution

$ npm run build && npm run package

Run the tests ✔️

$ npm test

Validate

You can now validate the action by referencing ./ in a workflow in your repo (see test.yml)

uses: ./
with:
  dry_run: true
  api_token: ${{secrets.GITHUB_TOKEN}}