Skip to content

rickstaa/action-update-semver

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

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub Action: Update major/minor semver

Docker Image CI Code quality CI Release GitHub release (latest SemVer)

This GitHub Action simplifies the process of updating major/minor release tags on a tag push. For example, it automatically updates both v1 and v1.2 tags when releasing version v1.2.3. Additionally, it provides the option to move the patch version up to the latest commit, making it convenient for use with tools like auto-changelog to automatically generate changelogs for your releases.

It's designed to seamlessly integrate with GitHub Actions. For more details on versioning your action, refer to GitHub Actions documentation.

Inputs

tag

Optional. Specifies the existing tag to update from. Defaults to $GITHUB_REF.

message

Optional. Custom tag message. Default: Release $TAG.

major_version_tag_only

Optional. Creates only major version tags. Default: false.

move_patch_tag

Optional. Moves the existing tag to the latest commit inside the GitHub Action. Default: false. Note that this only works when you explicitly specify a tag to prevent unexpected changes.

github_token

Optional. Only required for checkout@v1 action; otherwise, it's not necessary if you use checkout@v2 or higher.

gpg_private_key

Optional. Specifies the GPG private key to sign the tag with. Default: "".

gpg_passphrase

Optional. Specifies the GPG passphrase to sign the tag with. Default: "".

Example Usage

General example

name: Update Semver
on:
  push:
    branches-ignore:
      - "**"
    tags:
      - "v*.*.*"
jobs:
  update-semver:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: rickstaa/action-update-semver@v1
        with:
          major_version_tag_only: true # (optional, default is "false")

Certainly! Here's a refined version of your documentation:

Signing Tags with GPG

To sign tags with GPG, follow these steps:

1. Generate a GPG Key

First, generate a GPG key. Once generated, export the GPG private key in ASCII armored format to your clipboard using one of the following commands based on your operating system:

  • macOS:

    gpg --armor --export-secret-key joe@foo.bar | pbcopy
  • Ubuntu (GNU base64):

    gpg --armor --export-secret-key joe@foo.bar -w0 | xclip -selection clipboard
  • Arch:

    gpg --armor --export-secret-key joe@foo.bar | xclip -selection clipboard -i
  • FreeBSD (BSD base64):

    gpg --armor --export-s[.github/workflows/update_semver.yml](.github/workflows/update_semver.yml)e your GPG passphrase.

3. Update Workflow YAML

Modify your workflow YAML file to include the GPG private key and passphrase in the gpg_private_key and gpg_passphrase inputs:

name: Update Semver
on:
  push:
    branches-ignore:
      - "**"
    tags:
      - "v*.*.*"
jobs:
  update-semver:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: rickstaa/action-update-semver@v1
        with:
          gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
          gpg_passphrase: ${{ secrets.PASSPHRASE }}
          major_version_tag_only: true # (optional, default is "false")

This workflow will now sign tags using the specified GPG key during tag creation.

Contributing

Feel free to open an issue if you have ideas on how to improve this GitHub Action or if you want to report a bug! All contributions are welcome. 🚀 Please consult the contribution guidelines for more information.

Acknowledgment

This action is based on @haya14busa's update-major-minor-semver.