npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gh-calver-release

v0.1.4

Published

Create a Release PR and a Release using calver

Downloads

68

Readme

gh-calver-release

Create a Release PR and a Release using calver

Overview

There are cases where you want to release a website or application with calendar versioning. This tool can be used in such cases and is supposed to be used with GitHub Actions. Inspired from git-pr-release and github-pr-release.

You can run gh-calver-release create:pr on any event such as workflow_dispatch. This will create a pull request for release. The description of the Pull Request will be created using the Automatically generated release notes feature. You can also customize the description using .github/release.yml. See further configuration options.

The gh-calver-release create:release is executed when the release PR is merged. In fact, releases are also created when a hotfix enters the base branch directly. This command will create a release with the tag of calendar versioning.

Usage

gh-calver-release create:pr

Create a file named .github/workflows/create-release-pr.yml. (You can change the file name if you like.)

name: Create Release PR
on:
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest
    timeout-minutes: 5
    steps:
    - name: Create release pull request
      run: |
        npx gh-calver-release create:pr --repo ${{ github.repository }} --base main --head develop
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
$ gh-calver-release create:pr --help
gh-calver-release create:pr

Create release pull request

Options:
      --repo     The name of the owner and repository. The name is not case sensitive. (e.g. owner/repo)  [string] [required]
      --base     The name of the branch you want the changes pulled into. This should be an existing branch on the current repository.  [string] [required]
      --head     The name of the branch where your changes are implemented.  [string] [required]
      --format   Pick favorite format from https://github.com/muratgozel/node-calver#choose-format. The default is "yyyy.0m.0d.minor".  [string]
      --level    If the format has been changed, the level must also be changed to the appropriate one. The default is "calendar.minor".  [string]
  -h, --help     Show help  [boolean]
  -v, --version  Show version number  [boolean]

Examples:
  gh-calver-release create:pr --repo "banyan/gh-calver-release" --base "main" --head "develop"                                                       Specify only required argument usage
  gh-calver-release create:pr --repo "banyan/gh-calver-release" --base "main" --head "develop" --format "yyyy.0m.0d.minor" --level "calendar.minor"  Specify additional format and level usage

gh-calver-release create:release

Create a file named .github/workflows/create-release.yml. (You can change the file name if you like.)

name: Create Release
on:
  pull_request:
    branches:
      - main # base branch
    types:
      - closed

jobs:
  build:
    runs-on: ubuntu-latest
    timeout-minutes: 5
    if: github.event.pull_request.merged == true # detect when pull request is merged
    steps:
    - name: Create release
      run: |
        npx gh-calver-release create:release --repo ${{ github.repository }} --target_commitish main --pull_number ${{ github.event.pull_request.number }}
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
$ gh-calver-release create:release --help
gh-calver-release create:release

Create release

Options:
      --repo              The name of the owner and repository. The name is not case sensitive.  [string] [required]
      --target_commitish  Specifies the commitish value that determines where the Git tag is created from. Can be any branch or commit SHA. Unused if the Git tag already exists.  [string] [required]
      --pull_number       The number that identifies the pull request.  [number] [required]
      --format            Pick favorite format from https://github.com/muratgozel/node-calver#choose-format. The default is "yyyy.0m.0d.minor".  [string]
      --level             If the format has been changed, the level must also be changed to the appropriate one. The default is "calendar.minor".  [string]
  -h, --help              Show help  [boolean]
  -v, --version           Show version number  [boolean]

Examples:
  gh-calver-release create:release --repo "banyan/gh-calver-release" --target_commitish "main" --pull_number 1                                                        Specify only required argument usage
  gh-calver-release create:release  --repo "banyan/gh-calver-release" --target_commitish "main" --pull_number 1 --format "yyyy.0m.0d.minor" --level "calendar.minor"  Specify additional format and level usage

Example

https://github.com/banyan/gh-calver-release-example

  • Release PR: https://github.com/banyan/gh-calver-release-example/pull/3
  • Release: https://github.com/banyan/gh-calver-release-example/releases/tag/2022.09.27.0

Caveats

  • When you run gh-calver-release create:pr, both base branch and head branch must be existed.
  • For example, suppose that a release PR is created and then merged one day later. The version of the release PR title at that time is temporary, and the correct version will be set at the time of the actual release. The title of the Pull Request will also be updated.