Skip to content

fry69/release-init

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JSR JSR Score

release-init

Automated release tooling for Deno projects. Handles version management, changelog generation, testing, and GitHub releases with optional binary compilation.

Features

  • Version Management: Automated version bumping (major/minor/patch) with validation
  • Changelog Automation: Extracts and formats changelog entries for releases
  • GitHub Integration: Creates releases with changelogs and optional binary artifacts
  • Binary Compilation: Conditionally compiles and attaches platform-specific binaries
  • Project Initialization: Adds release automation to existing projects

Installation

Quick Start

Initialize release automation in an existing Deno project:

deno run -Ar jsr:@fry69/release-init

This copies the necessary workflows and tools to your project.

Manual Usage

Run tools directly without installation:

# Create a release
deno run -Ar jsr:@fry69/release-init/tools/release patch

# Extract metadata
deno run -Ar jsr:@fry69/release-init/tools/get-meta

# Get changelog for version
deno run -Ar jsr:@fry69/release-init/tools/get-changelog 1.0.0

Components

Init Tool (src/main.ts)

Installs release automation to existing Deno projects.

deno run -Ar jsr:@fry69/release-init [options] [target-directory]

Options:
  --force         Overwrite existing files
  --yes           Skip confirmation prompts
  --quiet         Suppress non-essential output
  --help          Show help message
  --version       Show version

Copies these files to target project:

  • .github/workflows/release.yml - GitHub Actions workflow
  • tools/release.ts - Release script
  • tools/get-meta.ts - Metadata extraction
  • tools/get-changelog.ts - Changelog parsing
  • tools/update-changelog.ts - Changelog updating
  • CHANGELOG.md - Changelog template (if missing)
  • LICENSE - MIT License (if missing)

Release Script (tools/release.ts)

Automates version bumps, testing, and git tagging.

deno task release [options] <version|major|minor|patch>

Options:
  -d, --dry-run   Stop before pushing to GitHub
  -y, --yes       Skip confirmation prompt
  -q, --quiet     Suppress non-essential output
  -h, --help      Show help message
  -v, --version   Show script version

Examples:
  deno task release 1.0.0      # Set specific version
  deno task release patch      # Bump patch (0.2.4 -> 0.2.5)
  deno task release minor      # Bump minor (0.2.4 -> 0.3.0)
  deno task release major      # Bump major (0.2.4 -> 1.0.0)

Workflow:

  1. Validates version bump
  2. Updates deno.json and entry point file
  3. Updates CHANGELOG.md with release date
  4. Runs test suite
  5. Creates git commit with changelog
  6. Creates annotated git tag with changelog
  7. Pushes commit and tag to remote

GitHub Workflow (.github/workflows/release.yml)

Automated workflow triggered on version tags. Handles:

  • Changelog Extraction: Parses CHANGELOG.md for release notes
  • Binary Compilation (optional): Compiles platform-specific binaries if compile:ci task exists
  • Release Creation: Creates GitHub release with changelog and artifacts

Supported platforms for binary compilation:

  • Linux x86_64
  • macOS x86_64
  • macOS ARM64
  • Windows x86_64

Metadata Tool (tools/get-meta.ts)

Extracts project metadata from deno.json:

deno task get-meta

Output format (GITHUB_OUTPUT compatible):
tool_name=release-init
tool_version=0.0.1
entry=./src/main.ts
has_compile_task=true

Changelog Tools

get-changelog.ts: Extracts changelog entry for specific version

deno task get-changelog 1.0.0

update-changelog.ts: Updates CHANGELOG.md with release date

deno task update-changelog 1.0.0

Binary Compilation

The workflow conditionally compiles binaries based on project configuration.

Enabling Binary Compilation

Add a compile:ci task to deno.json:

{
  "tasks": {
    "compile:ci": "deno compile -A --include templates"
  }
}

The workflow will:

  1. Detect the compile:ci task
  2. Run compilation for all supported platforms
  3. Package binaries as zip files
  4. Attach them to the GitHub release

Disabling Binary Compilation

Omit the compile:ci task. The workflow will skip compilation and create a release with only the changelog.

Project Requirements

  • Deno 2.1+ (for compilation with --include flag)
  • deno.json with name and version fields
  • CHANGELOG.md following Keep a Changelog format
  • Entry point file (default: ./src/main.ts) with VERSION constant
  • Git repository with GitHub remote

deno.json Structure

{
  "name": "@scope/package",
  "version": "0.1.0",
  "exports": {
    ".": "./src/main.ts"
  },
  "tasks": {
    "check": "deno fmt --check && deno lint && deno test",
    "compile:ci": "deno compile -A --include resources"
  }
}

Entry Point Structure

export const VERSION = "0.1.0";

// ... rest of code

Workflow Customization

The release workflow supports manual triggers with parameters:

  • Tag Name: Override automatic tag (e.g., v1.0.0-beta.1)
  • Release Name: Custom release title
  • Draft Mode: Create as draft instead of publishing

Trigger via GitHub Actions UI or:

gh workflow run release.yml -f tag_name=v1.0.0 -f draft=true

License

MIT License - see LICENSE for details.

Development

# Run tests
deno task test

# Check code quality
deno task check

# Compile local binary
deno task compile:local

# Install locally
deno task install:local

About

Automated release tooling for Deno projects. Handles version management, changelog generation, testing, and GitHub releases with optional binary compilation.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors