-
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: Add release and pre-release pipeline
- Loading branch information
Showing
3 changed files
with
140 additions
and
3 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,69 @@ | ||
name: 📦Create Pre-Release | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- develop | ||
types: | ||
- closed | ||
jobs: | ||
release: | ||
if: ${{ github.event.pull_request.merged }} | ||
name: 🏗️ Build package and publish to pypi | ||
runs-on: ubuntu-latest | ||
concurrency: release | ||
permissions: | ||
id-token: write | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/ligthml | ||
steps: | ||
- name: ⬇️ Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: 'develop' | ||
fetch-depth: 0 | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: 🐍Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version-file: "pyproject.toml" | ||
- name: 🧙♂️Install uv | ||
uses: astral-sh/setup-uv@v5 | ||
with: | ||
enable-cache: true | ||
cache-dependency-glob: "uv.lock" | ||
- name: 🔨Install dependencies | ||
run: uv sync --all-extras --dev | ||
- name: ⬇️ Download current coverage report | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: code-coverage-report-${{runner.os}}-3.10 | ||
path: ./coverage.xml | ||
- name: 📃Pytest coverage report | ||
id: coverageComment | ||
uses: MishaKav/pytest-coverage-comment@main | ||
with: | ||
hide-comment: true | ||
pytest-xml-coverage-path: ./coverage.xml | ||
|
||
- name: ✏️ Update Readme with Coverage Badge | ||
run: | | ||
sed -i '/<!-- Pytest Coverage Comment:Begin -->/,/<!-- Pytest Coverage Comment:End -->/c\<!-- Pytest Coverage Comment:Begin -->\n\${{ steps.coverageComment.outputs.coverageHtml }}\n<!-- Pytest Coverage Comment:End -->' ./README.md | ||
- name: 🚀 Python Semantic Release | ||
id: release | ||
uses: python-semantic-release/python-semantic-release@v9 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
force: "prerelease" | ||
|
||
- name: 🐍 Publish package distributions to PyPI | ||
if: steps.release.outputs.released == 'true' | ||
run: uv publish | ||
|
||
- name: 🐙 Publish package distributions to GitHub Releases | ||
uses: python-semantic-release/publish-action@9 | ||
if: steps.release.outputs.released == 'true' | ||
with: | ||
github_token: ${{ secrets.GITHUB_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
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,68 @@ | ||
name: 📦 Create Release | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
types: | ||
- closed | ||
jobs: | ||
release: | ||
if: ${{ github.event.pull_request.merged }} | ||
name: 🏗️ Build package and publish to pypi | ||
runs-on: ubuntu-latest | ||
concurrency: release | ||
permissions: | ||
id-token: write | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/ligthml | ||
steps: | ||
- name: ⬇️ Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: 'main' | ||
fetch-depth: 0 | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: 🐍Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version-file: "pyproject.toml" | ||
- name: 🧙♂️Install uv | ||
uses: astral-sh/setup-uv@v5 | ||
with: | ||
enable-cache: true | ||
cache-dependency-glob: "uv.lock" | ||
- name: 🔨Install dependencies | ||
run: uv sync --all-extras --dev | ||
- name: ⬇️ Download current coverage report | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: code-coverage-report-${{runner.os}}-3.10 | ||
path: ./coverage.xml | ||
- name: 📃Pytest coverage report | ||
id: coverageComment | ||
uses: MishaKav/pytest-coverage-comment@main | ||
with: | ||
hide-comment: true | ||
pytest-xml-coverage-path: ./coverage.xml | ||
|
||
- name: ✏️ Update Readme with Coverage Badge | ||
run: | | ||
sed -i '/<!-- Pytest Coverage Comment:Begin -->/,/<!-- Pytest Coverage Comment:End -->/c\<!-- Pytest Coverage Comment:Begin -->\n\${{ steps.coverageComment.outputs.coverageHtml }}\n<!-- Pytest Coverage Comment:End -->' ./README.md | ||
- name: 🚀 Python Semantic Release | ||
id: release | ||
uses: python-semantic-release/python-semantic-release@v9 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: 🐍 Publish package distributions to PyPI | ||
if: steps.release.outputs.released == 'true' | ||
run: uv publish | ||
|
||
- name: 🐙 Publish package distributions to GitHub Releases | ||
uses: python-semantic-release/publish-action@9 | ||
if: steps.release.outputs.released == 'true' | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} |