💸Save up to $132K/month in CI costs!👉 Try Free
Skip to main content
← Back to workflows

How to Automate GitHub Releases with Automatic Releases GitHub Action

marvinpinto/action-automatic-releases -
GitHub Action
Auto-generated release for tag latest
734
Contributors
Contributor - marvinpinto

Optimize Your CI/CD Pipeline

Get instant insights into your CI/CD performance and costs. Reduce build times by up to 45% and save on infrastructure costs.

45% Faster Builds
60% Cost Reduction
Usage
name: "pre-release"
on:
push:
branches:
- "master"

jobs:
pre-release:
name: "Pre Release"
runs-on: "ubuntu-latest"

steps:
- name: "Build & test"
run: echo "done!"

- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: true
title: "Development Build"
files: |
LICENSE.txt
*.jar

automatic-releases-action logo

automatic-releases-action

A GitHub Action to automate the release process with changelogs and asset uploads.


Automatic Releases GitHub Action simplifies the process of creating GitHub releases by automatically uploading assets, generating changelogs, handling pre-releases, and associating releases with tags.

Usage Example: Generate Release on Tag Push

This example triggers a release workflow whenever a tag matching the pattern v* is pushed. It uploads assets like LICENSE.txt and .jar files, generates a changelog, and creates a release associated with the tag.

name: "tagged-release"
on:
push:
tags:
- "v*"

jobs:
tagged-release:
name: "Tagged Release"
runs-on: "ubuntu-latest"

steps:
- name: "Build & test"
run: echo "done!"

- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
files: |
LICENSE.txt
*.jar

How to Provide GitHub Token

The repo_token input is required to authenticate with GitHub and perform actions like creating releases and uploading assets. It should be stored in your GitHub repository secrets as GITHUB_TOKEN.

with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"

How to Mark a Release as a Draft

The draft input determines whether to mark the release as a draft. If set to true, the release will not be published immediately.

with:
draft: true

How to Mark a Release as a Pre-release

The prerelease input allows you to mark the release as a pre-release, which is useful for testing and preview builds.

with:
prerelease: true

How to Set the Automatic Release Tag

The automatic_release_tag input specifies the tag name to associate with the automatic release. For example, you can use latest for development builds or vX.X.X for stable releases.

with:
automatic_release_tag: latest

How to Set a Custom Release Title

The title input lets you specify a custom release title. If no title is provided, the action defaults to using the tag name as the title.

with:
title: "Development Build"

How to Upload Files as Release Assets

The files input allows you to specify a list of files to upload as part of the release. You can use glob patterns to match multiple files (e.g., *.jar).

with:
files: |
LICENSE.txt
*.jar

Outputs

The action provides several outputs that can be accessed in subsequent steps:

  • automatic_releases_tag: The tag name for the release that was just processed.
  • upload_url: The URL for uploading additional assets to the release.

Example of accessing the output:

steps:
- id: release
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"

- name: "Log Release Tag"
run: echo "Tag: ${{ steps.release.outputs.automatic_releases_tag }}"

Event Triggers

You can trigger this action on various GitHub events such as:

  • Push to specific branches (e.g., master).
  • Push of a new tag.
  • Nightly releases based on cron schedules.

Example of triggering on tag push:

on:
push:
tags:
- "v*"