Skip to content

rui-costa/action-automatic-semver-releases

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

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.