Skip to content

Commit

Permalink
🛠️ Improve release workflow (#10)
Browse files Browse the repository at this point in the history
* ✨ Add job name for version bump and conditionally commit changes in release workflow

* 🔧 Update leader election configuration parameters for improved timing

* 👷 Update release workflow to lock dependencies after version bump
  • Loading branch information
grelinfo authored Nov 28, 2024
1 parent 5311acb commit af5f4d7
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 14 deletions.
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

0 comments on commit af5f4d7

Please sign in to comment.