Skip to content
Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Latest commit

 

History

109 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Git Multi-Platform Release Action

CI License: MIT TypeScript

A GitHub/Gitea action for creating and managing releases across multiple platforms. This action is based on ncipollo/release-action but extends it to support GitHub, Gitea, and self-hosted Gitea instances.

Features

  • Multi-Platform Support: Works with GitHub, Gitea (including self-hosted instances)
  • Auto-Detection: Automatically detects the platform from repository URL
  • Full Feature Parity: Matches all features from ncipollo/release-action
    • Create and update releases
    • Upload artifacts with glob pattern support
    • Draft and prerelease support
    • Release body from file or input
    • Generate release notes (GitHub only)
    • Tag creation if missing
    • Artifact replacement/removal
  • Extensible Architecture: Easy to add support for additional platforms (GitLab, Bitbucket, etc.)
  • Comprehensive Error Handling: Clear error messages and proper validation

Platform Detection

The action automatically detects the platform from the repository URL, but you can also explicitly specify it:

  1. Explicit Platform: Set the platform input to github or gitea
  2. Auto-Detection: If not specified, the action will:
    • Check if the repository URL contains github.com → GitHub
    • Check if the repository URL contains gitea.io or a custom domain → Gitea
    • Default to GitHub for GitHub Actions runners

Usage

Basic Usage (GitHub)

name: Release

on:
  push:
    tags:
      - 'v*.*.*'

jobs:
  release:
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - uses: actions/checkout@v6
      - uses: LiquidLogicLabs/git-action-release@v2
        with:
          tag: ${{ github.ref_name }}
          token: ${{ secrets.GITHUB_TOKEN }}

Basic Usage (Gitea - Self-Hosted)

name: Release

on:
  push:
    tags:
      - 'v*.*.*'

jobs:
  release:
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - uses: actions/checkout@v6
      - uses: LiquidLogicLabs/git-action-release@v2
        with:
          platform: 'gitea'
          tag: ${{ github.ref_name }}
          token: ${{ secrets.GITEA_TOKEN }}

With Artifacts

- uses: LiquidLogicLabs/git-action-release@v2
  with:
    tag: 'v1.0.0'
    artifacts: 'dist/*.zip,binaries/**/*'
    replaces-artifacts: true
    token: ${{ secrets.GITHUB_TOKEN }}

With Release Body File

- uses: LiquidLogicLabs/git-action-release@v2
  with:
    tag: 'v1.0.0'
    body-file: 'CHANGELOG.md'
    token: ${{ secrets.GITHUB_TOKEN }}

Explicit Platform Override

- uses: LiquidLogicLabs/git-action-release@v2
  with:
    platform: 'github'  # or 'gitea'
    tag: 'v1.0.0'
    token: ${{ secrets.GITHUB_TOKEN }}

Inputs

Platform Configuration

Input Description Required Default
platform Platform type (github or gitea). If not provided, will auto-detect from repository URL No Auto-detect
token Platform token for authentication No ${{ github.token }}

Release Configuration

Input Description Required Default
tag Tag for the release. If omitted, the git ref will be used (if it is a tag) No -
name Name for the release. If omitted, the tag will be used No -
body Body for the release. Note: This input will have white space trimmed. Use body-file if you need a non-trivial markdown body No -
body-file Body file for the release. This should be the path to the file No -
draft Marks this release as a draft release No false
prerelease Marks this release as prerelease No false
commit Commit reference. This will be used to create the tag if it does not exist No -

Artifacts

Input Description Required Default
artifacts Paths representing artifacts to upload. This may be a single path or a comma delimited list of paths (or globs) No -
artifact-content-type The content type of the artifact No application/octet-stream
replaces-artifacts Indicates if existing release artifacts should be replaced No true
remove-artifacts Indicates if existing release artifacts should be removed before uploading No false
artifact-errors-fail-build Indicates if artifact read or upload errors should fail the build No false

Release Management

Input Description Required Default
allow-updates Indicates if we should update a release if it already exists No false
skip-if-release-exists When enabled, the action will be skipped if a non-draft release already exists for the provided tag No false
update-only-unreleased When allow-updates is enabled, this will fail the action if the release it is updating is not a draft or a prerelease No false

Release Notes

Input Description Required Default
generate-release-notes Indicates if release notes should be automatically generated (GitHub only) No false
generate-release-notes-previous-tag Previous tag to use when generating release notes. This will limit the release notes to changes between the two tags No -

Advanced Options

Input Description Required Default
repository Repository in owner/repo format (e.g., LiquidLogicLabs/git-action-release). If provided, takes precedence over owner and repo inputs No -
owner Optionally specify the owner of the repo where the release should be generated. Defaults to current repo owner No -
repo Optionally specify the repo where the release should be generated. Defaults to current repo No -
omit-body Indicates if the release body should be omitted No false
omit-body-during-update Indicates if the release body should be omitted during updates No false
omit-draft-during-update Indicates if the draft flag should be omitted during updates No false
omit-name Indicates if the release name should be omitted No false
omit-name-during-update Indicates if the release name should be omitted during updates No false
omit-prerelease-during-update Indicates if the prerelease flag should be omitted during updates No false
skip-certificate-check Skip TLS certificate verification for API calls (self-hosted instances) No false
verbose Enable verbose debug logging No false

Outputs

Output Description
id The identifier of the created release
html-url The HTML URL of the release
upload-url The URL for uploading assets to the release
tarball-url The URL for downloading the release as a tarball (.tar.gz)
zipball-url The URL for downloading the release as a zipball (.zip)
assets JSON string containing a map of asset names to download URLs for uploaded assets

Permissions

Creating or updating releases requires contents: write. The job must have a token with sufficient scope (default GITHUB_TOKEN or GITEA_TOKEN is usually sufficient when the job has the right permissions).

Examples

Complete GitHub Release Workflow

name: Release

on:
  push:
    tags:
      - 'v*.*.*'

permissions:
  contents: write

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

      - name: Build artifacts
        run: |
          npm run build
          npm run package

      - name: Set release token
        env:
          RELEASE_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: echo "RELEASE_TOKEN set"

      - uses: LiquidLogicLabs/git-action-release@v2
        with:
          tag: ${{ github.ref_name }}
          name: Release ${{ github.ref_name }}
          body-file: CHANGELOG.md
          artifacts: 'dist/*.zip,dist/*.tar.gz'
          generate-release-notes: true
          token: ${{ env.RELEASE_TOKEN }}

Complete Gitea Release Workflow (Self-Hosted)

name: Release

on:
  push:
    tags:
      - 'v*.*.*'

permissions:
  contents: write

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

      - name: Build artifacts
        run: |
          npm run build
          npm run package

      - name: Set release token (Gitea)
        env:
          RELEASE_TOKEN: ${{ secrets.GITEA_TOKEN }}
        run: echo "RELEASE_TOKEN set"

      - uses: LiquidLogicLabs/git-action-release@v2
        with:
          platform: 'gitea'
          tag: ${{ github.ref_name }}
          name: Release ${{ github.ref_name }}
          body-file: CHANGELOG.md
          artifacts: 'dist/*.zip,dist/*.tar.gz'
          token: ${{ env.RELEASE_TOKEN }}

Draft Release with Auto-Update

- uses: LiquidLogicLabs/git-action-release@v2
  with:
    tag: 'v1.0.0'
    draft: true
    allow-updates: true
    artifacts: 'build/*.zip'
    token: ${{ secrets.GITHUB_TOKEN }}

Prerelease

- uses: LiquidLogicLabs/git-action-release@v2
  with:
    tag: 'v1.0.0-beta.1'
    prerelease: true
    body: 'Beta release for testing'
    token: ${{ secrets.GITHUB_TOKEN }}

Platform-Specific Notes

GitHub

  • Supports all features including automatic release notes generation
  • Uses GitHub REST API v3
  • Requires contents: write permission

Gitea

  • Supports most features except automatic release notes generation (Gitea API doesn't support this)
  • Uses Gitea API v1
  • Automatically detects Gitea URL from GITHUB_SERVER_URL environment variable (available in Gitea Actions)
  • Requires repository access token with release permissions

Gitea Release Lookup Retries

When Gitea returns an empty response body on release creation, the action retries fetching the release by tag. You can tune the retry behavior with environment variables:

  • GITEA_RELEASE_LOOKUP_MAX_RETRIES (default: 10)
  • GITEA_RELEASE_LOOKUP_BASE_DELAY_MS (default: 500)
  • GITEA_RELEASE_LOOKUP_MAX_DELAY_MS (default: 8000)

Example workflow configuration:

      - uses: LiquidLogicLabs/git-action-release@v2
        env:
          GITEA_RELEASE_LOOKUP_MAX_RETRIES: '12'
          GITEA_RELEASE_LOOKUP_BASE_DELAY_MS: '750'
          GITEA_RELEASE_LOOKUP_MAX_DELAY_MS: '10000'
        with:
          platform: 'gitea'
          tag: ${{ github.ref_name }}
          token: ${{ secrets.GITEA_TOKEN }}

Migration from ncipollo/release-action

If you're migrating from ncipollo/release-action, the action is largely compatible. The main differences are:

  1. Platform Detection: The action now auto-detects the platform, but you can override it
  2. Gitea Support: Added support for Gitea and self-hosted Gitea instances
  3. Additional Input: platform input for multi-platform support

To migrate:

  1. Replace ncipollo/release-action@v1 with LiquidLogicLabs/git-action-release@v2
  2. If using Gitea, add platform: 'gitea' input (Gitea URL is auto-detected from environment)
  3. All other inputs remain the same

Security

  • The action automatically masks tokens in logs using core.setSecret()
  • Tokens are never logged or exposed
  • Use GitHub Secrets or Gitea Secrets for storing tokens
  • Use the least privilege principle when creating tokens

Troubleshooting

Platform Not Detected

If platform detection fails, explicitly set the platform input:

platform: 'github'  # or 'gitea'

Gitea Connection Issues

For self-hosted Gitea instances:

  1. Ensure GITHUB_SERVER_URL environment variable is set correctly (this is automatically set by Gitea Actions)
  2. Verify the token has release permissions
  3. Check network connectivity from the runner to your Gitea instance

Artifact Upload Failures

  • Ensure artifact paths are correct and files exist
  • Check file permissions
  • For large files, consider using a different upload mechanism
  • Set artifact-errors-fail-build: true to fail fast on errors

Testing

This project includes comprehensive tests at multiple levels:

  • Unit Tests: Test individual components in isolation
  • Integration Tests (Mocked): Test components with mocked HTTP responses
  • E2E Tests: Full end-to-end tests with real API calls

Running Tests

# Run unit tests
npm run test:unit

# Run integration tests (mocked)
npm run test:integration

# Run E2E tests (requires tokens)
export GITHUB_TOKEN="your-token"
export GITEA_TOKEN="your-token"
npm run test:e2e

# Run all tests (unit + integration, excludes E2E)
npm run test:all

For detailed testing information, see docs/TESTING.md.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Before submitting:

  1. Run tests: npm run test:all
  2. Run linter: npm run lint
  3. Ensure all tests pass locally

License

This project is licensed under the MIT License - see the LICENSE file for details.

Credits

This action is based on ncipollo/release-action and extends it with multi-platform support. Special thanks to the original authors and contributors.

About

Multi-platform release action (GitHub, Gitea, self-hosted Gitea)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages