Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: CI

on:
push:
workflow_dispatch:

jobs:
Tests:
Expand Down
30 changes: 12 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,25 @@ on:
push:
branches:
- main
tags:
- 'v*'

jobs:

Release-And-Publish:
runs-on: ubuntu-latest
concurrency: release-${{ github.ref_type }}
concurrency: release
permissions:
actions: read
actions: write
contents: write
id-token: write
steps:
- name: 📥 checkout
uses: actions/checkout@v7
with:
fetch-depth: 0
persist-credentials: false
- name: 🔧 setup uv
uses: ./.github/uv
- name: 📜 semantic release version & publish on PyPI
run: |
if [[ "$GITHUB_REF_TYPE" == "tag" ]]; then
uv run semantic-release changelog --post-to-release-tag "$GITHUB_REF_NAME"
echo "🙆🏽 Publishing on PyPI"
uv build
uv run twine upload dist/*
exit 0
fi

next_version=$(uv run semantic-release version --print)
last_released_version=$(uv run semantic-release version --print-last-released)
if [[ "$next_version" == "$last_released_version" ]]; then
Expand All @@ -43,15 +32,16 @@ jobs:
uv run semantic-release version --no-push --no-vcs-release
release_sha=$(git rev-parse HEAD)
release_branch="release/${release_tag}-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"
release_remote="https://${GITHUB_ACTOR}:${RELEASE_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
git push "$release_remote" "HEAD:refs/heads/${release_branch}"
git push origin "HEAD:refs/heads/${release_branch}"
gh workflow run ci.yml --ref "$release_branch"

ci_run_id=""
for _ in {1..120}; do
ci_run_id=$(gh run list \
--workflow ci.yml \
--branch "$release_branch" \
--commit "$release_sha" \
--event workflow_dispatch \
--limit 1 \
--json databaseId \
--jq '.[0].databaseId')
Expand All @@ -66,13 +56,17 @@ jobs:
fi

gh run watch "$ci_run_id" --exit-status
git push --atomic "$release_remote" \
git push --atomic origin \
"HEAD:refs/heads/main" \
"refs/tags/${release_tag}:refs/tags/${release_tag}"
git push "$release_remote" --delete "$release_branch"
git push origin --delete "$release_branch"
gh workflow run doc.yml --ref "$release_tag"
uv run semantic-release changelog --post-to-release-tag "$release_tag"
echo "🙆🏽 Publishing on PyPI"
uv build
uv run twine upload dist/*
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
Loading