Skip to content

Commit

Permalink
ci: configure release with semantic-release (#1)
Browse files Browse the repository at this point in the history
### Summary of Changes

Configure `semantic-release`.
  • Loading branch information
lars-reimann authored Aug 10, 2023
1 parent 0e39585 commit 1fe0223
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/release.yml
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 }}
35 changes: 35 additions & 0 deletions release.config.js
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'],
},
],
],
};

0 comments on commit 1fe0223

Please sign in to comment.