Skip to content

Commit

Permalink
fix: release process with semantic release is now working (at least l…
Browse files Browse the repository at this point in the history
…ocally)
  • Loading branch information
Guibod committed Feb 17, 2023
1 parent 9e5540a commit f3c7bdc
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions release_config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
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: [RELEASE_BRANCH],
plugins: [
[
"@semantic-release/commit-analyzer",
{
preset: "conventionalcommits",
},
],
[
"@semantic-release/release-notes-generator",
{
preset: "conventionalcommits",
},
],
[
"@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.",
},
],
[
"@semantic-release/exec",
{
verifyConditionsCmd: `if [ 403 != $(curl -X POST -F ":action=file_upload" -u __token__:$PYPI_TOKEN -s -o /dev/null -w "%{http_code}" ${PYPI_REPOSITORY}) ]; then (exit 0); else (echo "Authentication error. Please check the PYPI_TOKEN environment variable." && exit 1); fi`,
prepareCmd: "poetry version ${nextRelease.version}",
publishCmd: `poetry config repositories.repo ${PYPI_REPOSITORY} && poetry publish --build --repository repo --username __token__ --password $PYPI_TOKEN --no-interaction -vvv`,
},
],
[
"@google/semantic-release-replace-plugin",
{
replacements: [
{
files: ["src/mightstone/__init__.py"],
ignore: ["test/*", "tests/*"],
from: "__version__ = [\"'].*[\"']",
to: '__version__ = "${nextRelease.version}"',
},
],
},
],
[
"@semantic-release/github",
{
assets: [
{ path: "dist/*.tar.gz", label: "sdist" },
{ path: "dist/*.whl", label: "wheel" },
],
successComment:
":tada: This issue has been resolved in version ${nextRelease.version} :tada:\n\nThe release is available on PyPI and GitHub.",
failComment: false,
},
],
[
"@semantic-release/git",
{
assets: ["pyproject.toml", "*/__init__.py", CHANGELOG_FILE],
},
],
],
};

0 comments on commit f3c7bdc

Please sign in to comment.