Core Action: Manage Release
Overview
The Manage Release action provides a standardized interface for working with GitHub draft releases. It supports three main operations:
- Creating/ensuring a draft release exists
- Getting current draft release information
- Updating draft release content
Usage
Draft Operation
Creates a new draft release or returns existing one:
- name: Create Draft Release
uses: deepworks-net/github.toolkit/actions/core/manage_release@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
operation: 'draft'
name: 'Release v1.0.0'
body: 'Initial release notes'
Get Operation
Retrieves current draft release information:
- name: Get Draft Release
uses: deepworks-net/github.toolkit/actions/core/manage_release@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
operation: 'get'
Update Operation
Updates draft release content with different modes:
- name: Update Draft Release
uses: deepworks-net/github.toolkit/actions/core/manage_release@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
operation: 'update'
content: 'New content to add'
update_mode: 'append' # or 'replace', 'prepend'
Inputs
Input | Description | Required | Default |
---|---|---|---|
github-token |
GitHub token for API access | Yes | - |
operation |
Operation to perform (draft, get, update) | No | get |
name |
Release name for draft operation | No | Draft Release |
body |
Initial release body for draft operation | No | '' |
content |
Content for update operation | No* | - |
update_mode |
How to update content (replace, append, prepend) | No | replace |
*Required for update operation
Outputs
Output | Description |
---|---|
id |
Release ID |
body |
Release content |
tag_name |
Release tag name |
name |
Release name |
exists |
Whether draft release exists (true/false) |
Behavior
Draft Operation
- Checks for existing draft release
- If none exists, creates new draft
- Returns release information
Get Operation
- Fetches current draft release
- Returns release information if exists
- Indicates if no draft exists
Update Operation
- Gets current draft release
- Updates content based on mode:
replace
: Overwrites existing contentappend
: Adds to end of contentprepend
: Adds to beginning of content
- Returns updated release information
Error Handling
The action handles several error cases:
-
Invalid Operation
- Unsupported operation specified
- Missing required inputs for operation
-
GitHub API Errors
- Authentication failures
- Rate limiting
- Network issues
-
Content Errors
- Missing content for update
- Invalid update mode
- Release not found for update
Example Use Cases
Release Preparation
jobs:
prepare:
steps:
- name: Create Draft
uses: deepworks-net/github.toolkit/actions/core/manage_release@v1
with:
operation: 'draft'
name: 'Release v1.0.0'
PR Merge Updates
on:
pull_request:
types: [closed]
branches: [main]
jobs:
update-notes:
if: github.event.pull_request.merged == true
steps:
- name: Update Release Notes
uses: deepworks-net/github.toolkit/actions/core/manage_release@v1
with:
operation: 'update'
content: |
- PR #${{ github.event.pull_request.number }}: ${{ github.event.pull_request.title }}
update_mode: 'append'
Release Status Check
jobs:
check:
steps:
- name: Check Draft Release
id: release
uses: deepworks-net/github.toolkit/actions/core/manage_release@v1
- name: Create if Missing
if: steps.release.outputs.exists == 'false'
uses: deepworks-net/github.toolkit/actions/core/manage_release@v1
with:
operation: 'draft'
Implementation
Core Files
main.py
: Release management logicaction.yml
: Action metadataDockerfile
: Container configuration
Dependencies
- Python 3.9
- Git
- curl
- GitHub API access