Skip to content

Commit

Permalink
ci: add GitHub Actions workflow for CI and release automation
Browse files Browse the repository at this point in the history
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
liblaf committed Nov 21, 2024
1 parent 364d7a3 commit f20c617
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/ci.yaml
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

0 comments on commit f20c617

Please sign in to comment.