-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: configure release with semantic-release (#1)
### Summary of Changes Configure `semantic-release`.
- Loading branch information
1 parent
0e39585
commit 1fe0223
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: Release to PyPI | ||
|
||
on: | ||
workflow_dispatch | ||
|
||
jobs: | ||
release: | ||
uses: lars-reimann/.github/.github/workflows/poetry-pypi-reusable.yml@main | ||
with: | ||
working-directory: . | ||
python-version: "3.10" | ||
secrets: | ||
GITHUB_PAT: ${{ secrets.PAT }} | ||
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Based on https://github.com/bjoluc/semantic-release-config-poetry/blob/main/release.config.js | ||
|
||
const PYPI_REPOSITORY = 'https://upload.pypi.org/legacy/'; | ||
|
||
module.exports = { | ||
branches: ['main'], | ||
plugins: [ | ||
['@semantic-release/commit-analyzer', { preset: 'conventionalcommits' }], | ||
['@semantic-release/release-notes-generator', { preset: 'conventionalcommits' }], | ||
['@semantic-release/changelog', { changelogFile: 'docs/CHANGELOG.md' }], | ||
[ | ||
'@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 publish --build --username __token__ --password $PYPI_TOKEN --no-interaction -vvv', | ||
}, | ||
], | ||
[ | ||
'@semantic-release/github', | ||
{ | ||
assets: [ | ||
{ path: 'dist/*.tar.gz', label: 'sdist' }, | ||
{ path: 'dist/*.whl', label: 'wheel' }, | ||
], | ||
}, | ||
], | ||
[ | ||
'@semantic-release/git', | ||
{ | ||
assets: ['pyproject.toml', 'docs/CHANGELOG.md'], | ||
}, | ||
], | ||
], | ||
}; |