Initial Release:
https://chatgpt.com/share/6941a2a4-7974-800f-8911-9ab0bf1e3873
This commit is contained in:
71
.github/workflows/ci-and-mark-stable.yml
vendored
Normal file
71
.github/workflows/ci-and-mark-stable.yml
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
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
|
||||
Reference in New Issue
Block a user