Skip to content

✨Improve release workflow #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Nov 28, 2024
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
35 changes: 25 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,56 @@ on:

jobs:
bump-version:
name: Bump version
runs-on: ubuntu-latest
steps:

- name: Generate a token
id: generate_token
- name: Generate GitHub App Token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.GRELINFO_ID }}
private-key: ${{ secrets.GRELINFO_KEY }}

- name: Get GitHub App User ID
id: user-id
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}

- name: Configure Git App Credentials
run: |
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
git config --global user.email '${{ steps.user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}@users.noreply.github.com>'

- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.ref_name }}
token: ${{ steps.generate_token.outputs.token }}
token: ${{ steps.app-token.outputs.token }}
persist-credentials: false

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true

- name: Get release version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
id: release-version
run: echo "release-version=${GITHUB_REF#refs/*/}" >> "$GITHUB_OUTPUT"

- name: Get current version
run: echo "CURRENT_VERSION=$(uv run hatch version)" >> $GITHUB_ENV
id: current-version
run: echo "current-version=$(uv run hatch version)" >> "$GITHUB_OUTPUT"

- name: Bump version if necessary
if: ${{ env.RELEASE_VERSION != env.CURRENT_VERSION }}
run: uv run hatch version $RELEASE_VERSION
if: ${{ steps.release-version.outputs.release-version != steps.current-version.outputs.current-version }}
run: |
uv run hatch version $RELEASE_VERSION
uv lock

- name: Commit and push changes
if: ${{ steps.release-version.outputs.release-version != steps.current-version.outputs.current-version }}
run: |
git config user.name "grelinfo[bot]"
git config user.email "702069+grelinfo[bot]@users.noreply.github.com"
git add .
git commit -m "🚀 Release $RELEASE_VERSION"
git tag -f $RELEASE_VERSION
Expand Down
8 changes: 4 additions & 4 deletions tests/sync/test_leaderelection.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ def configs() -> list[LeaderElectionConfig]:
LeaderElectionConfig(
name="test_leader_election",
worker=f"worker_{i}",
lease_duration=0.01,
renew_deadline=0.008,
retry_interval=0.001,
lease_duration=0.02,
renew_deadline=0.015,
retry_interval=0.005,
error_interval=0.01,
backend_timeout=0.007,
backend_timeout=0.005,
)
for i in range(WORKERS)
]
Expand Down