@ross/semantic-release-forgejo (1.0.0)
Installation
@ross:registry=npm install @ross/semantic-release-forgejo@1.0.0"@ross/semantic-release-forgejo": "1.0.0"About this package
@ross/semantic-release-forgejo
semantic-release plugin to publish a Forgejo (or Gitea) release.
| Step | Description |
|---|---|
verifyConditions |
Verify the presence and the validity of the authentication and the assets option configuration. |
publish |
Publish a Forgejo release, optionally uploading file assets. |
addChannel |
Update a Forgejo release's pre-release field. |
Forked from saitho/semantic-release-gitea and modernized for TypeScript, ESM, and Forgejo.
Install
$ npm install @ross/semantic-release-forgejo --save-dev
Usage
The plugin can be configured in the semantic-release configuration file:
{
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
["@ross/semantic-release-forgejo", {
"forgejoUrl": "https://git.reslate.solutions",
"assets": [
{"path": "dist/asset.min.css", "label": "CSS distribution"},
{"path": "dist/asset.min.js", "label": "JS distribution"}
]
}]
]
}
Forgejo Authentication
The Forgejo authentication configuration is required and can be set via environment variables.
Create an API key token via your Forgejo installation's web interface: Settings → Applications → Generate New Token.
The token has to be made available in your CI environment via the FORGEJO_TOKEN environment variable.
The user associated with the token must have push permission to the repository.
Environment Variables
| Variable | Description |
|---|---|
FORGEJO_TOKEN |
Required. The token used to authenticate with Forgejo. |
FORGEJO_URL |
Required. The URL to your Forgejo instance. |
FORGEJO_PREFIX |
The Forgejo API prefix. (default: /api/v1) |
Options
| Option | Description | Default |
|---|---|---|
forgejoUrl |
The Forgejo endpoint. | FORGEJO_URL environment variable. |
forgejoApiPathPrefix |
The Forgejo API prefix. | FORGEJO_PREFIX environment variable. |
assets |
Files to upload to the release. | — |
Assets
The assets option can be a glob or an array of globs and objects with the following properties:
| Property | Description | Default |
|---|---|---|
path |
Required. A glob to identify the files to upload. | — |
name |
The name of the downloadable file on the Forgejo release. | File name from path. |
label |
Short description displayed on the Forgejo release. | — |
Asset Examples
{
"assets": "dist/*.js"
}
Include all .js files in the dist directory.
{
"assets": [["dist", "!**/*.css"]]
}
Include all files in dist and its subdirectories, excluding .css files.
{
"assets": [
{"path": "dist/MyLibrary.js", "label": "JS distribution"},
{"path": "dist/MyLibrary.css", "label": "CSS distribution"}
]
}
Include specific files with custom labels.
Note: File types may need to be allowed in your Forgejo instance's attachment settings (
AttachmentAllowedTypesin the[attachment]scope).
CI / Forgejo Actions
Use this plugin in a Forgejo Actions workflow to auto-publish releases on every push to main.
name: Release
on:
push:
branches: [main]
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: "22"
- run: npm ci
- run: npm run build
- run: npx semantic-release
env:
FORGEJO_URL: "https://git.reslate.solutions"
FORGEJO_TOKEN: ${{ secrets.PKG_RELEASE_TOKEN }}
Set
FORGEJO_TOKEN(and optionallyNPM_TOKENif publishing to a package registry) in your repo's Settings → Secrets.
Package Registry Publishing
If you publish to a Forgejo npm registry, add an .npmrc:
@your-scope:registry=https://git.reslate.solutions/api/packages/ross/npm/
//git.reslate.solutions/api/packages/ross/npm/:_authToken=${NPM_TOKEN}
Then configure @semantic-release/npm in your .releaserc.json:
{
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/npm",
["@ross/semantic-release-forgejo", {
"forgejoUrl": "https://git.reslate.solutions"
}]
]
}
License
MIT
Dependencies
Dependencies
| ID | Version |
|---|---|
| @semantic-release/error | ^4.0.0 |
| aggregate-error | ^5.0.0 |
| debug | ^4.3.0 |
| dir-glob | ^3.0.0 |
| form-data | ^4.0.0 |
| globby | ^14.0.0 |
| url-join | ^5.0.0 |
Development dependencies
| ID | Version |
|---|---|
| @commitlint/cli | ^19.0.0 |
| @commitlint/config-conventional | ^19.0.0 |
| @semantic-release/changelog | ^6.0.3 |
| @semantic-release/commit-analyzer | ^13.0.0 |
| @semantic-release/git | ^10.0.1 |
| @semantic-release/npm | ^12.0.0 |
| @semantic-release/release-notes-generator | ^14.0.0 |
| @types/debug | ^4.1.13 |
| @types/fs-extra | ^11.0.4 |
| @types/node | ^22.0.0 |
| @types/url-join | ^4.0.3 |
| conventional-changelog-conventionalcommits | ^8.0.0 |
| eslint | ^9.0.0 |
| eslint-config-prettier | ^10.1.8 |
| husky | ^9.0.0 |
| prettier | ^3.0.0 |
| semantic-release | ^25.0.0 |
| typescript | ^5.5.0 |
| typescript-eslint | ^8.59.2 |
| vitest | ^3.0.0 |