-
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 GitHub Actions workflow for CI and release automation
This commit introduces a new GitHub Actions workflow to automate the Continuous Integration (CI) process and manage releases. The workflow includes jobs for building the project, uploading artifacts, and publishing to PyPI. Additionally, it handles pre-release actions for the main branch.
- Loading branch information
Showing
1 changed file
with
71 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,71 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup uv | ||
uses: astral-sh/setup-uv@v3 | ||
- name: Install Dependencies | ||
run: uv sync --all-extras | ||
- name: Build | ||
run: uv build | ||
- name: Upload Artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: dist | ||
path: dist/ | ||
|
||
release: | ||
name: Release | ||
permissions: | ||
id-token: write | ||
needs: | ||
- build | ||
if: github.event_name == 'release' | ||
runs-on: ubuntu-latest | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
steps: | ||
- name: Download Artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: dist | ||
path: dist/ | ||
- name: Publish to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
|
||
pre-release: | ||
name: Pre-Release | ||
permissions: | ||
contents: write | ||
needs: | ||
- build | ||
if: github.ref == 'refs/heads/main' | ||
runs-on: ubuntu-latest | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
steps: | ||
- name: Download Artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: dist | ||
path: dist/ | ||
- name: Create GitHub Release | ||
uses: liblaf/actions/release@main | ||
with: | ||
clobber: true | ||
files: dist/* | ||
prerelease: true | ||
tag: latest |