Skip to content

Automate releasing a new version of a GitHub workflow or action

License

Notifications You must be signed in to change notification settings

brobeson/ActionRelease

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Action Release

Workflow Quality GitHub Release

This is a reusable workflow to tag and release a new version of a GitHub action or workflow. The workflow takes a semantic version as input. It validates the version, tags the repository on the main branch, and creates a GitHub Release.

The input version must be a 3-component semantic version: A.B.C. (The version may have a v prefix; the workflow accounts for that.) It then creates the tag vA.B.C. It also force creates the tags vA.B and vA at the same commit. This lets users of your workflow automatically get updates that they want.

Getting Started

To use this workflow, just set it in the uses key of a job in your project's workflow file. Here is an example workflow snippet that calls this workflow with a hard code 1.0.0 version:

jobs:
  release:
    name: New Release
    uses: brobeson/ActionRelease/.github/workflows/release.yaml@v1
    with:
      version: "1.0.0"

Manually Running Your Workflow

One method to pass a new version to this workflow, is for your calling workflow to use on.workflow_dispatch and require a version input.

on:
  workflow_dispatch:
    inputs:
      version:
        description: The new version.
        required: true
        type: string
jobs:
  release:
    name: New Release
    uses: brobeson/ActionRelease/.github/workflows/release.yaml@v1
    with:
      version: ${{inputs.version}}

Warning

The action release workflow will fail if you try to automatically run it when you create a tag in your repository. I'll address this in a future version of the action release workflow.

Inputs

Key Required Type Description
version yes string The semantic version of the new release.

Steps

The workflow runs the following steps.

  1. Verify the Version
    The version must be a 3-component semantic version. This step verifies the input. A v prefix, such as v1.0.0, is allowed; the workflow strips it out.
  2. Clone the Repository
    This step just clones the repository to the runner.
  3. Tag the Repository
    This step creates the local tags vA.B.C, vA.B, and vA on the main branch. The tags vA.B and vA are created with --force; if they already exist, they move to the new commit.
  4. Push the Tags
    This step force pushes the new tags to the origin remote.
  5. Create a Release
    This step creates a new GitHub Release at the new vA.B.C tag. The release title is A.B.C. For now, the release notes are empty.

Issue Tracking

GitHub Issues or Pull Requests by label GitHub Issues or Pull Requests by label GitHub Issues or Pull Requests by label GitHub milestone details

Report a bug | Request a new step | Update an existing step

About

Automate releasing a new version of a GitHub workflow or action

Topics

Resources

License

Stars

Watchers

Forks