Skip to content

Commit 0989068

Browse files
committed
feat: enhance release automation with daily checks
1 parent 6d36b5a commit 0989068

File tree

2 files changed

+50
-16
lines changed

2 files changed

+50
-16
lines changed

.github/workflows/daily-release-check.yml

Lines changed: 48 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,59 @@ name: Daily Release Check
22

33
on:
44
schedule:
5-
- cron: '0 0 * * *' # Run at midnight UTC daily
6-
workflow_dispatch: # Allow manual triggers
5+
# Run every day at 9:00 UTC
6+
- cron: '0 9 * * *'
7+
# Allow manual trigger for testing
8+
workflow_dispatch:
79

810
jobs:
9-
check-releases:
11+
prepare:
1012
runs-on: ubuntu-latest
13+
outputs:
14+
matrix: ${{ steps.set-matrix.outputs.matrix }}
15+
last_release: ${{ steps.last-release.outputs.hash }}
1116
steps:
1217
- uses: actions/checkout@v4
1318
with:
14-
fetch-depth: 0 # Need full history for git log
15-
16-
- name: Set up Python
17-
uses: actions/setup-python@v4
19+
fetch-depth: 0
20+
21+
- name: Find package directories
22+
id: set-matrix
23+
run: |
24+
DIRS=$(git ls-tree -r HEAD --name-only | grep -E "package.json|pyproject.toml" | xargs dirname | grep -v "^.$" | jq -R -s -c 'split("\n")[:-1]')
25+
echo "matrix=${DIRS}" >> $GITHUB_OUTPUT
26+
27+
- name: Get last release hash
28+
id: last-release
29+
run: |
30+
HASH=$(git rev-list --tags --max-count=1 || echo "HEAD~1")
31+
echo "hash=${HASH}" >> $GITHUB_OUTPUT
32+
33+
check-release:
34+
needs: prepare
35+
runs-on: ubuntu-latest
36+
strategy:
37+
matrix:
38+
directory: ${{ fromJson(needs.prepare.outputs.matrix) }}
39+
fail-fast: false
40+
41+
steps:
42+
- uses: actions/checkout@v4
1843
with:
19-
python-version: '3.11'
20-
21-
- name: Install dependencies
44+
fetch-depth: 0
45+
46+
- uses: astral-sh/setup-uv@v5
47+
48+
- name: Setup Node.js
49+
if: endsWith(matrix.directory, 'package.json')
50+
uses: actions/setup-node@v4
51+
with:
52+
node-version: '18'
53+
54+
- name: Setup Python
55+
if: endsWith(matrix.directory, 'pyproject.toml')
56+
run: uv python install
57+
58+
- name: Check release
2259
run: |
23-
python -m pip install semver PyGithub rich toml click
24-
25-
- name: Run release check
26-
env:
27-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28-
run: python scripts/weekly-release.py --dry-run
60+
uv run --script scripts/release.py --dry-run "${{ matrix.directory }}" "${{ needs.prepare.outputs.last_release }}"

scripts/release.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ def main(directory: Path, git_hash: GitHash, dry_run: bool) -> int:
170170
publish_package(path, pkg_type, version, dry_run)
171171
if not dry_run:
172172
click.echo(f"{name}@{version}")
173+
else:
174+
click.echo(f"🔍 Dry run: Would have published {name}@{version} if this was a real release")
173175
return 0
174176
except Exception as e:
175177
return 1

0 commit comments

Comments
 (0)