GitHub Action
Tag/Release on Push Action
Stop using files for versioning. Use git tags instead!
Github Action to create a Github Release on pushes to master.
- Flexible version bumping scheme with a project default or overrides using Pull Request Labels
- Creates Release Notes automatically (with a list of commits since the last release)
CI & CD systems are simpler when they work with immutable monotonic identifers from the get-go. Trigger your release activites by subscribing to new tags pushed from this Action.
For automation, Github Releases (and by extension git tags) are better than versioned commit files for these reasons:
- Agnostic of language & ecosystem (i.e. does not rely on presence of package.json)
- Tagging does not require write permissions to bump version
- Tagging does not trigger infinite-loop webhooks from pushing version bump commits
on:
push:
branches:
- master
jobs:
release-on-push:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: rymndhng/release-on-push-action@master
with:
bump_version_scheme: minor
Allowed values of bump_version_scheme
:
- minor
- major
- patch
- norelease: Performs no release by default. Creation of release delegated to labels on Pull Requests.
For stability, we recommend pinning the version of the action. See Releases.
There are several approaches:
- Put
[norelease]
in the commit title. - If the commit has an attached PR, add the label
norelease
to the PR. - Set the action's
bump_version_scheme
tonorelease
to disable this behavior by default
Iif the PR has the label release:major
, release:minor
, or release:patch
, this will override bump_version_scheme
.
This repository's pull requests are an example of this in action. For example, #19.
Only one of these labels should be present on a PR. If there are multiple, the behavior is undefined.
No, you do not! Github Actions will inject a token for this plugin to interact with the API.
Currently, no.
In order to reliably generate monotonic versions, we use Github Releases to track what the last release version is. See Release#get-the-latest-release.
On a successful release, this action creates an output parameters tag_name
and version
.
Example of how to consume this:
on:
push:
branches:
- master
jobs:
release-on-push:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- id: release
uses: rymndhng/release-on-push-action@master
with:
bump_version_scheme: minor
tag_prefix: v
- name: Check Output Parameters
run: |
echo "Got tag name ${{ steps.release.outputs.tag_name }}"
echo "Got release version ${{ steps.release.outputs.version }}"
Yes you can, with release_body
. The contents of this be appended to the release description.
Example:
on:
push:
branches:
- master
jobs:
release-on-push:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: rymndhng/release-on-push-action@master
with:
bump_version_scheme: minor
release_body: "When set, adds extra text to body!"
Yes, you can customize this by changing the tag_prefix
. Here's an example of
removing the prefix by using an empty string.
on:
push:
branches:
- master
jobs:
release-on-push:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: rymndhng/release-on-push-action@master
with:
tag_prefix: ""
Use the option max_commits
. The default value is 50.
on:
push:
branches:
- master
jobs:
release-on-push:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: rymndhng/release-on-push-action@master
with:
max_commits: 100
Uses babashka.
To run tests:
- Install babashka (link).
- Run Tests
make test
# run integration tests
source local-test.env
make integration-tests