Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

action-releaser

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

action-releaser

GitHub Action to attach files to a release

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

Social Card of this repo

npm version GitHub Actions Commitizen friendly

Asset Releaser

A GitHub Action to easily attach files to a GitHub release.

Usage

This action allows you to attach files to a GitHub release using simple glob patterns to specify the files.

- name: Attach Files to Release
  uses: stacksjs/action-releaser@v1.0.0
  with:
    files: |
      bin/app-linux-x64
      bin/app-linux-arm64
      bin/app-windows-x64.exe
      bin/app-darwin-x64
      bin/app-darwin-arm64
    # Optional parameters:
    # token: ${{ secrets.GITHUB_TOKEN }}
    # tag: ${{ github.ref_name }}
    # draft: false
    # prerelease: false
    # note: 'Release notes'

Inputs

NameDescriptionRequiredDefault
filesList of files to attach to the releaseYesN/A
tokenGitHub tokenNo${{ github.token }}
tagThe tag name for the releaseNo${{ github.ref_name }}
draftCreate a draft releaseNofalse
prereleaseMark as prereleaseNofalse
noteRelease notesNo(empty)
homebrewFormulaPath to the Homebrew formula template fileNo(empty)
homebrewRepoRepository to update the Homebrew formula in (format: owner/repo)No(empty)
homebrewBranchBranch name in the Homebrew repository to commit toNomain
homebrewPathPath in the Homebrew repository where formulas are storedNoFormula
homebrewCommitFormatCommit message format for Homebrew formula updatesNoupdate: {{ formula }} to {{ version }}

Examples

Basic Usage

name: Release

on:
  push:
    tags:
      - 'v*'

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      # Build your application
      - name: Build
        run: |
          npm ci
          npm run build

      # Create a release and attach files
      - name: Create Release and Attach Files
        uses: stacksjs/action-releaser@v1.0.0
        with:
          files: |
            dist/app.zip
            dist/app.tar.gz

Homebrew Formula Update

This action can automatically update a Homebrew formula in a tap repository when you create a release.

Required Permissions

Important: The Homebrew formula update feature requires a GitHub token with write permissions to the target repository. The default GITHUB_TOKEN only has access to the current repository, not to external repositories.

To update a formula in a different repository:

  • Create a Personal Access Token (PAT) with the repo scope (or at minimum contents:write)
  • Store it as a repository secret (e.g., HOMEBREW_TOKEN)
  • Pass this token to the action using the token parameter
name: Release with Homebrew Update

on:
  push:
    tags:
      - 'v*'

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      # Build your application
      - name: Build
        run: |
          npm ci
          npm run build

      # Create a release, attach files, and update Homebrew formula
      - name: Create Release, Attach Files, and Update Homebrew Formula
        uses: stacksjs/action-releaser@v1.0.0
        with:
          files: |
            dist/app-darwin-arm64.tar.gz
            dist/app-darwin-x64.tar.gz
            dist/app-linux-arm64.tar.gz
            dist/app-linux-x64.tar.gz
          homebrewFormula: .github/homebrew-formula.rb
          homebrewRepo: yourusername/homebrew-tap
          homebrewPath: Formula
          homebrewCommitFormat: 'chore(homebrew): update {{ formula }} to version {{ version }}'
          token: ${{ secrets.HOMEBREW_TOKEN }} # PAT with write access to the homebrew repo

Homebrew Formula Template

Create a template file (e.g., .github/homebrew-formula.rb) that includes placeholders for the version and download URLs:

class YourApp < Formula
  desc "Your application description"
  homepage "https://github.com/yourusername/yourrepo"
  version "{{ version }}"

  on_macos do
    if Hardware::CPU.arm?
      url "{{ app-darwin-arm64.tar.gz_url }}"
      sha256 "UPDATE_WITH_ACTUAL_SHA_AFTER_RELEASE"
    else
      url "{{ app-darwin-x64.tar.gz_url }}"
      sha256 "UPDATE_WITH_ACTUAL_SHA_AFTER_RELEASE"
    end
  end

  on_linux do
    if Hardware::CPU.arm?
      url "{{ app-linux-arm64.tar.gz_url }}"
      sha256 "UPDATE_WITH_ACTUAL_SHA_AFTER_RELEASE"
    else
      url "{{ app-linux-x64.tar.gz_url }}"
      sha256 "UPDATE_WITH_ACTUAL_SHA_AFTER_RELEASE"
    end
  end

  def install
    bin.install "yourapp"
  end

  test do
    system "#{bin}/yourapp", "--version"
  end
end

Template Variables:

  • {{ version }} - The version number (without the 'v' prefix if present in the tag)
  • {{ filename_url }} - The download URL for each uploaded asset (replace 'filename' with the actual filename)

Advanced Usage

name: Release with Notes

on:
  push:
    tags:
      - 'v*'

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      # Generate release notes
      - name: Generate Release Notes
        id: release-notes
        run: echo "NOTES=$(./scripts/generate-notes.sh)" >> $GITHUB_OUTPUT

      # Create a release and attach files
      - name: Create Release and Attach Files
        uses: stacksjs/action-releaser@v1.0.0
        with:
          files: |
            dist/*.zip
            dist/*.tar.gz
          note: ${{ steps.release-notes.outputs.NOTES }}
          draft: true
          prerelease: ${{ contains(github.ref, '-beta') || contains(github.ref, '-alpha') }}

Testing

bun test

Changelog

Please see our releases page for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Community

For help, discussion about best practices, or any other conversation that would benefit from being searchable:

Discussions on GitHub

For casual chit-chat with others using this package:

Join the Stacks Discord Server

Postcardware

"Software that is free, but hopes for a postcard." We love receiving postcards from around the world showing where Stacks is being used! We showcase them on our website too.

Our address: Stacks.js, 12665 Village Ln #2306, Playa Vista, CA 90094, United States 🌎

Sponsors

We would like to extend our thanks to the following sponsors for funding Stacks development. If you are interested in becoming a sponsor, please reach out to us.

License

The MIT License (MIT). Please see LICENSE for more information.

Made with 💙

Keywords

github

FAQs

Package last updated on 07 May 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts