Skip to content

Commit

Permalink
feat: Add support for RELEASE_BRANCH and CHANGELOG_FILE environme…
Browse files Browse the repository at this point in the history
…nt variables

Please check the readme's configuration section for details.

Co-authored-by: bjoluc <mail@bjoluc.de>
  • Loading branch information
miigotu and bjoluc authored Sep 20, 2022
1 parent 0a72d46 commit 96dcd00
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
11 changes: 10 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,16 @@ inputs:
github_token:
description: "A GitHub API token (to publish GitHub releases and comment on resolved issues)"
required: true

pypi_repository:
description: "The repository to upload your Python package to (e.g., `https://upload.pypi.org/legacy/` for PyPI, or `https://test.pypi.org/legacy/` for Test PyPI)"
required: false
release_branch:
description: "The name of the Git branch to be released"
required: false
changelog_file:
description: "The path of the changelog file"
required: false

runs:
using: "composite"
Expand All @@ -25,7 +32,9 @@ runs:
- name: Release
shell: bash
env:
PYPI_REPOSITORY: ${{ inputs.pypi_repository }}
PYPI_TOKEN: ${{ inputs.pypi_token }}
GITHUB_TOKEN: ${{ inputs.github_token }}
PYPI_REPOSITORY: ${{ inputs.pypi_repository }}
RELEASE_BRANCH: ${{ inputs.release_branch }}
CHANGELOG_FILE: ${{ inputs.changelog_file }}
run: npx semantic-release --extends @bjoluc/semantic-release-config-poetry
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,5 @@ Furthermore, the following optional environment variables can be set:
| Environment variable | Description | Default value |
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------- |
| `PYPI_REPOSITORY` | The repository to upload your Python package to (e.g., `https://upload.pypi.org/legacy/` for PyPI, or `https://test.pypi.org/legacy/` for Test PyPI) | `https://upload.pypi.org/legacy/` |
| `RELEASE_BRANCH` | The name of the Git branch to be released | `main` |
| `CHANGELOG_FILE` | The path of the changelog file | `CHANGELOG.md` |
7 changes: 5 additions & 2 deletions release.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
const PYPI_REPOSITORY = process.env.PYPI_REPOSITORY ?? "https://upload.pypi.org/legacy/";
const RELEASE_BRANCH = process.env.RELEASE_BRANCH ?? "main";
const CHANGELOG_FILE = process.env.CHANGELOG_FILE ?? "CHANGELOG.md";

const config = {
branches: ["main"],
branches: [RELEASE_BRANCH],
plugins: [
[
"@semantic-release/commit-analyzer",
Expand All @@ -18,6 +20,7 @@ const config = {
[
"@semantic-release/changelog",
{
changelogFile: CHANGELOG_FILE,
changelogTitle:
"# Changelog\n\nAll notable changes to this project will be documented in this file. See\n[Conventional Commits](https://conventionalcommits.org) for commit guidelines.",
},
Expand Down Expand Up @@ -59,7 +62,7 @@ const config = {
[
"@semantic-release/git",
{
assets: ["pyproject.toml", "*/__init__.py", "CHANGELOG.md"],
assets: ["pyproject.toml", "*/__init__.py", CHANGELOG_FILE],
},
],
],
Expand Down

0 comments on commit 96dcd00

Please # to comment.