Code Monkey home page Code Monkey logo

release-on-push-action's Introduction

Github Release On Push Action

Stop using files for versioning. Use git tags instead!

Github Action to create a Github Release on pushes to master.

Features

  • 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)

Rationale

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

Example Workflow

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.

FAQ

Can I skip creation of a release?

There are several approaches:

  1. Put [norelease] in the commit title.
  2. If the commit has an attached PR, add the label norelease to the PR.
  3. Set the action's bump_version_scheme to norelease to disable this behavior by default

How do I change the bump version scheme using Pull Requests?

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.

Do I need to setup Github Action access tokens or any other permission-related thing?

No, you do not! Github Actions will inject a token for this plugin to interact with the API.

Can I create a tag instead of a release?

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.

How can I get the generated tag or version?

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
          
      - name: Check Output Parameters
        run: |
          echo "Got tag name ${{ steps.release.outputs.tag_name }}"
          echo "Got release version ${{ steps.release.outputs.version }}"

Development

Uses babashka.

To run tests:

  1. Install babashka (link).
  2. Run Tests
make test

# run integration tests
source local-test.env
make integration-tests

Big Thanks To

release-on-push-action's People

Contributors

dmitriystoyanov avatar rymndhng avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.