Skip to content

Commit

Permalink
ci: add release-please & publish on release
Browse files Browse the repository at this point in the history
  • Loading branch information
loiccoyle committed Jul 4, 2024
1 parent 4fa7ca8 commit 8807d0e
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .github/.release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "1.0.0"
}
13 changes: 13 additions & 0 deletions .github/release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"packages": {
".": {
"changelog-path": "CHANGELOG.md",
"release-type": "python",
"bump-minor-pre-major": false,
"bump-patch-for-minor-pre-major": false,
"draft": false,
"prerelease": false
}
},
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
}
44 changes: 41 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
pull_request:

jobs:
ci:
tests:
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -44,9 +44,47 @@ jobs:
- name: Run pytest
run: poetry run pytest -q tests

release:
name: release
if: ${{ github.ref == 'refs/heads/main' && github.repository_owner == 'loiccoyle' }}
needs:
- tests
outputs:
release_created: ${{ steps.release.release_created }}
runs-on: ubuntu-latest
steps:
- uses: googleapis/release-please-action@v4
id: release
with:
config-file: .github/release-please-config.json
manifest-file: .github/.release-please-manifest.json

publish:
name: Publish to pypi
needs:
- release
if: needs.release.outputs.release_created
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- uses: abatilo/actions-poetry@v3
with:
poetry-version: 1.8.3

- name: Configure Pypi token
shell: bash
run: poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}

- name: Publish Package
shell: bash
run: poetry publish --build

readme:
runs-on: ubuntu-latest
needs: ci
needs: tests
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -62,7 +100,7 @@ jobs:
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "ci: Update readme"
commit_message: "docs: update readme"
branch: ${{ github.head_ref }}
commit_user_name: github-actions[bot]
commit_user_email: github-actions[bot]@users.noreply.github.com
Expand Down

0 comments on commit 8807d0e

Please sign in to comment.