Automatically create versions in MantisHub when you release new versions of your software. This action integrates your GitHub release workflow with MantisHub's version tracking system.
This GitHub Action creates a new version entry in your MantisHub project via the MantisHub REST API. It's designed to be triggered when a new tag is pushed to your repository, keeping your MantisHub project versions synchronized with your GitHub releases.
Key Features:
- Automatically create MantisHub versions from GitHub tags
- Configurable version metadata (description, release status, timestamps)
- Returns the created version ID for use in subsequent workflow steps
Before using this action, you need:
- A MantisHub account with access to the project where versions will be created
- A MantisHub API key with permissions to create versions
- The project name in MantisHub (must match exactly)
- Log in to your MantisHub instance
- Navigate to your user preferences/account settings
- Generate a new API token with appropriate permissions
- Store the token as a GitHub secret (see Security section)
| Input | Required | Default | Description |
|---|---|---|---|
url |
Yes | - | Base URL of your MantisHub instance (e.g., https://example.mantishub.io) |
api-key |
Yes | - | API key for MantisHub authentication |
project |
Yes | - | Name of the project in MantisHub (case-sensitive) |
name |
Yes | - | Version name to create (e.g., v1.2.0) |
description |
No | - | Description of the version/release |
released |
No | true |
Set to true if version is released, false if unreleased |
obsolete |
No | false |
Set to true to mark version as obsolete |
timestamp |
No | Current time | Release date in ISO format (e.g., 2025-09-20) |
| Output | Description |
|---|---|
version-id |
The unique ID of the created version in MantisHub |
Access this output in subsequent steps using: ${{ steps.<step-id>.outputs.version-id }}
Create a version with minimal configuration:
- name: Create MantisHub Version
uses: mantishub/action-create-version@v1
with:
url: https://example.mantishub.io
api-key: ${{ secrets.MANTISHUB_API_KEY }}
project: 'MyProject'
name: 'v1.0.0'The most common use case is to automatically create a MantisHub version when you push a new tag:
name: Create MantisHub Version on Release
on:
push:
tags:
- 'v*' # Triggers on tags starting with 'v' (e.g., v1.0.0, v2.1.3)
jobs:
create-mantishub-version:
runs-on: ubuntu-latest
steps:
- name: Create Version in MantisHub
id: create-version
uses: mantishub/action-create-version@v1
with:
url: ${{ secrets.MANTISHUB_URL }}
api-key: ${{ secrets.MANTISHUB_API_KEY }}
project: 'MyProject'
name: ${{ github.ref_name }} # Automatically uses the tag name (e.g., v1.2.0)
description: |
Release ${{ github.ref_name }}
Commit: ${{ github.sha }}
released: true
- name: Log Created Version
run: echo "Created MantisHub version with ID ${{ steps.create-version.outputs.version-id }}"Create a MantisHub version when a GitHub Release is published:
name: Sync GitHub Release to MantisHub
on:
release:
types: [published]
jobs:
sync-to-mantishub:
runs-on: ubuntu-latest
steps:
- name: Create MantisHub Version
uses: mantishub/action-create-version@v1
with:
url: ${{ secrets.MANTISHUB_URL }}
api-key: ${{ secrets.MANTISHUB_API_KEY }}
project: 'MyProject'
name: ${{ github.event.release.tag_name }}
description: ${{ github.event.release.body }}
released: ${{ !github.event.release.prerelease }}
timestamp: ${{ github.event.release.published_at }}A complete example showing all available options:
name: MantisHub Version Management
on:
workflow_dispatch:
inputs:
version:
description: 'Version name'
required: true
is_released:
description: 'Mark as released'
type: boolean
default: true
jobs:
create-version:
runs-on: ubuntu-latest
steps:
- name: Create Version in MantisHub
id: create-version
uses: mantishub/action-create-version@v1
with:
url: 'https://example.mantishub.io'
api-key: ${{ secrets.MANTISHUB_API_KEY }}
project: 'MyProject'
name: ${{ inputs.version }}
description: |
Release ${{ inputs.version }}
Created via GitHub Actions workflow.
released: ${{ inputs.is_released }}
obsolete: false
timestamp: '2025-09-20'
- name: Use Version ID
run: |
echo "Successfully created version!"
echo "Version ID: ${{ steps.create-version.outputs.version-id }}"Important: Never hardcode your MantisHub API key in workflow files.
- Go to your repository on GitHub
- Navigate to Settings > Secrets and variables > Actions
- Click New repository secret
- Create a secret named
MANTISHUB_API_KEYwith your API key as the value - Optionally, create
MANTISHUB_URLfor your instance URL
Reference secrets in your workflow using ${{ secrets.MANTISHUB_API_KEY }}.
Error: Project not found
- Verify the project name matches exactly (case-sensitive)
- Ensure your API key has access to the specified project
Error: Authentication failed
- Check that the API key is correctly stored in GitHub secrets
- Verify the API key hasn't expired
- Ensure the API key has permission to create versions
Error: Invalid URL
- Ensure the URL includes the protocol (
https://) - Don't include a trailing slash in the URL
- Verify the MantisHub instance is accessible
Error: Version already exists
- MantisHub may not allow duplicate version names
- Check if a version with the same name already exists in the project
Enable debug logging in your workflow by adding this secret:
- Name:
ACTIONS_STEP_DEBUG - Value:
true
This action uses the MantisHub REST API:
- Get Projects:
GET /api/rest/projects - Create Version:
POST /api/rest/projects/{project_id}/versions
For more information about the MantisHub API, refer to your MantisHub instance's API documentation.
Contributions are welcome! Please feel free to submit issues or pull requests to the mantishub/action-create-version repository.
This project is licensed under the terms specified in the repository.