ReviewOS

stacks/action-releaser

public
Clone

Push over the same URL. A password will not work: create a token under access tokens and use it in place of one.

main
· 7 branches · 113 commits

Mirrored from stacksjs/action-releaser · syncing is switched off

README.md

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 glob patterns to specify the files.


- name: Attach Files to Release

  uses: stacksjs/action-releaser@v1.2.6
  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: $
# tag: $
# draft: false
# prerelease: false
# note: 'Release notes'

Glob Pattern Support

The files input supports full glob patterns powered by @actions/glob:


- name: Attach Files with Glob Patterns

  uses: stacksjs/action-releaser@v1.2.6
  with:
    files: |
# Match all .tar.gz files in specific directories
      ion-binaries/ion-linux-x64/_.tar.gz
      ion-binaries/ion-linux-arm64/_.tar.gz
      ion-binaries/ion-darwin-x64/_.tar.gz
      ion-binaries/ion-darwin-arm64/_.tar.gz
# Match all .zip files
      ion-binaries/ion-windows-x64/_.zip
      ion-binaries/ion-windows-arm64/_.zip
# Or use wildcards
      dist/**/*.zip
      build/**/app-_

Inputs

NameDescriptionRequiredDefault
filesList of files to attach to the releaseYesN/A
tokenGitHub tokenNo$
tagThe tag name for the releaseNo$
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: to

Examples

Basic Usage

name: Releaser

on:
  push:
    tags:

      - 'v_'

jobs:
  npm:
    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.2.6
        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:

  1. Create a Personal Access Token (PAT) with the repo scope (or at minimum contents:write)
  2. Store it as a repository secret (e.g., HOMEBREW_TOKEN)
  3. 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.2.6
        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  to 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 ""

  on_macos do
    if Hardware::CPU.arm?
      url ""
      sha256 "UPDATE_WITH_ACTUAL_SHA_AFTER_RELEASE"
    else
      url ""
      sha256 "UPDATE_WITH_ACTUAL_SHA_AFTER_RELEASE"
    end
  end

  on_linux do
    if Hardware::CPU.arm?
      url ""
      sha256 "UPDATE_WITH_ACTUAL_SHA_AFTER_RELEASE"
    else
      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:

  • - The version number (without the 'v' prefix if present in the tag)
  • - 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.2.6
        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 💙

[codecov-href]: https://codecov.io/gh/stacksjs/action-releaser -->