72 lines
1.6 KiB
YAML
72 lines
1.6 KiB
YAML
name: CI + Mark Stable
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
permissions:
|
|
contents: write # required to move the stable tag
|
|
|
|
jobs:
|
|
ci:
|
|
name: Test & Lint
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0 # required to access tags
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.12"
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install ruff
|
|
pip install .
|
|
|
|
- name: Run tests
|
|
run: |
|
|
make test
|
|
|
|
- name: Run ruff
|
|
run: |
|
|
ruff check src tests
|
|
|
|
mark-stable:
|
|
name: Mark stable tag
|
|
runs-on: ubuntu-latest
|
|
needs: ci
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Find latest version tag
|
|
id: version
|
|
run: |
|
|
git fetch --tags
|
|
TAG=$(git tag --list 'v*' --sort=-version:refname | head -n 1)
|
|
if [ -z "$TAG" ]; then
|
|
echo "No version tag found, skipping stable tagging."
|
|
exit 0
|
|
fi
|
|
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Move stable tag to latest version
|
|
if: steps.version.outputs.tag != ''
|
|
run: |
|
|
TAG="${{ steps.version.outputs.tag }}"
|
|
echo "Marking $TAG as stable"
|
|
|
|
git tag -f stable "$TAG"
|
|
git push origin :refs/tags/stable || true
|
|
git push origin stable --force
|