feat: enhance release automation with daily checks
This commit is contained in:
parent
6d36b5a1ff
commit
0989068ef1
2 changed files with 50 additions and 16 deletions
62
.github/workflows/daily-release-check.yml
vendored
62
.github/workflows/daily-release-check.yml
vendored
|
|
@ -2,27 +2,59 @@ name: Daily Release Check
|
||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 0 * * *' # Run at midnight UTC daily
|
# Run every day at 9:00 UTC
|
||||||
workflow_dispatch: # Allow manual triggers
|
- cron: '0 9 * * *'
|
||||||
|
# Allow manual trigger for testing
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check-releases:
|
prepare:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
||||||
|
last_release: ${{ steps.last-release.outputs.hash }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0 # Need full history for git log
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Set up Python
|
- name: Find package directories
|
||||||
uses: actions/setup-python@v4
|
id: set-matrix
|
||||||
with:
|
|
||||||
python-version: '3.11'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
run: |
|
||||||
python -m pip install semver PyGithub rich toml click
|
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]')
|
||||||
|
echo "matrix=${DIRS}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Run release check
|
- name: Get last release hash
|
||||||
env:
|
id: last-release
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
run: |
|
||||||
run: python scripts/weekly-release.py --dry-run
|
HASH=$(git rev-list --tags --max-count=1 || echo "HEAD~1")
|
||||||
|
echo "hash=${HASH}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
check-release:
|
||||||
|
needs: prepare
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
directory: ${{ fromJson(needs.prepare.outputs.matrix) }}
|
||||||
|
fail-fast: false
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- uses: astral-sh/setup-uv@v5
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
if: endsWith(matrix.directory, 'package.json')
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '18'
|
||||||
|
|
||||||
|
- name: Setup Python
|
||||||
|
if: endsWith(matrix.directory, 'pyproject.toml')
|
||||||
|
run: uv python install
|
||||||
|
|
||||||
|
- name: Check release
|
||||||
|
run: |
|
||||||
|
uv run --script scripts/release.py --dry-run "${{ matrix.directory }}" "${{ needs.prepare.outputs.last_release }}"
|
||||||
|
|
|
||||||
|
|
@ -170,6 +170,8 @@ def main(directory: Path, git_hash: GitHash, dry_run: bool) -> int:
|
||||||
publish_package(path, pkg_type, version, dry_run)
|
publish_package(path, pkg_type, version, dry_run)
|
||||||
if not dry_run:
|
if not dry_run:
|
||||||
click.echo(f"{name}@{version}")
|
click.echo(f"{name}@{version}")
|
||||||
|
else:
|
||||||
|
click.echo(f"🔍 Dry run: Would have published {name}@{version} if this was a real release")
|
||||||
return 0
|
return 0
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return 1
|
return 1
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue