Skip to content
box

GitHub Action

Automatic Semver Release

1.1.1 Latest version

Automatic Semver Release

box

Automatic Semver Release

Github Semver Automatic Release

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Automatic Semver Release

uses: rui-costa/action-automatic-semver-releases@1.1.1

Learn more about this action in rui-costa/action-automatic-semver-releases

Choose a version

Github SemVer Automatic Release

This action automatically creates a compliant semver release, by generating a changelog from your commits. It automatically manages the MAJOR, MINOR and PATCH version numbers, depending on the input provided.

Contents

  1. πŸš€ Usage Examples
  2. πŸ’» Input Parameters
  3. 🏷 Versioning
  4. πŸ” Security
  5. πŸ“œ License

Usage Examples

Manually release your software and decide which version to increment

---
name: 'Release'

on:
  workflow_dispatch:
    inputs:
      semver:
        description: 'Which version you want to increment? Use MAJOR, MINOR or PATCH'
        required: true
        default: 'PATCH'
      label:
        description: 'Add Labels. i.e final, alpha, rc'
        required: false
        default: ''

jobs:
  release:
    name: 'Release'
    runs-on: 'ubuntu-latest'

    steps:
      # Checkout sources
      - name: 'Checkout'
        uses: actions/checkout@v2

      # ...
      - name: 'πŸ‘·β€β™‚οΈ Build'
        run: |
          echo "BUILD COMPLETE πŸ‘"

      # ...
      - name: 'πŸ§ͺ TEST'
        run: |
          echo "TESTS PASSED πŸŽ‰"

      - uses: 'rui-costa/action-automatic-semver-releases@{latest}'
        with:
          TOKEN: '${{ secrets.GITHUB_TOKEN }}'
          SEMVER: '${{ github.event.inputs.semver }}'
          LABEL: '${{ github.event.inputs.label }}'

Use your own release notes

---
name: 'Release'

on:
  workflow_dispatch:
    inputs:
      semver:
        description: 'Which version you want to increment? Use MAJOR, MINOR or PATCH'
        required: true
        default: 'PATCH'
      label:
        description: 'Add Labels. i.e final, alpha, rc'
        required: false
        default: ''

jobs:
  release:
    name: 'Release'
    runs-on: 'ubuntu-latest'

    steps:
      # Checkout sources
      - name: 'Checkout'
        uses: actions/checkout@v2

      # ...
      - name: 'πŸ‘·β€β™‚οΈ Build'
        run: |
          echo "BUILD COMPLETE πŸ‘"

      # ...
      - name: 'πŸ§ͺ TEST'
        run: |
          echo "TESTS PASSED πŸŽ‰"

      # This action may not exist, please check
      - name: 'βš™ GENERATE RELEASE NOTES'
        id: 'gen-notes'
        uses: 'rui-costa/action-auto-generate-release-notes@{latest}'

      - uses: 'rui-costa/action-automatic-semver-releases@{latest}'
        with:
          TOKEN: '${{ secrets.GITHUB_TOKEN }}'
          SEMVER: '${{ github.event.inputs.semver }}'
          LABEL: '${{ github.event.inputs.label }}'
          NOTES: '${{ steps.gen-notes.outputs.notes }}'

Input Parameters

Below is a list of all supported input parameters

Parameter Description Required Default
TOKEN Secret token from GitHub.secrets.GITHUB_TOKEN YES null
SEMVER Which version you want to increment? Use MAJOR, MINOR or PATCH NO PATCH
LABEL Add Labels. i.e final, alpha, rc NO null
NOTES Release Notes to override the autogenerated changelog. NO null

Versioning

All commits to main will generate a new PATCH version of this action. If you want to use the most recent one, keep the @latest tag.

Security

Security is a very important topic. As explained in the bullet above, any changes will generate a new tag. But even by tagging a specific version you can never be 100% sure of the code that will run on your workflow. If you don't trust the code that will be execute, don't worry, there are other ways.

  • You can fork the repo for yourself and use it, validate the code and use it as is. Or,
  • You can copy the workflow resources/release.yml into your repo and get the same value from this GitHub action. There is no reference to any third-party actions or software.

Disadvantage: If you opt by the resources/release.yml approach, you will not receive any updates when new features are released.

License

The source code for this project is released under the MIT License.