-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (79 loc) · 2.88 KB
/
Copy pathsync-base-version.yml
File metadata and controls
94 lines (79 loc) · 2.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: Sync pixie-sdk Version
on:
schedule:
# Align with daily release cadence (5am PST / 13:00 UTC)
- cron: "0 13 * * *"
workflow_dispatch:
jobs:
sync-version:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: latest
virtualenvs-create: true
virtualenvs-in-project: true
- name: Install Dependencies for Script
run: pip install packaging
- name: Determine latest pixie-sdk and current package version
id: versions
env:
BASE_PACKAGE: pixie-sdk
run: |
set -euo pipefail
LATEST=$(curl -s https://pypi.org/pypi/${BASE_PACKAGE}/json | jq -r '.info.version')
export LATEST
python - <<'PY'
import os
import tomllib
from pathlib import Path
from packaging.version import Version
latest = os.environ["LATEST"]
data = tomllib.loads(Path("pyproject.toml").read_text())
current = data["tool"]["poetry"]["version"]
update = Version(latest) > Version(current)
output = Path(os.environ["GITHUB_OUTPUT"])
output.write_text(
f"latest={latest}\ncurrent={current}\nupdate={'true' if update else 'false'}\n",
encoding="utf-8",
)
PY
- name: Log versions (no update needed)
if: steps.versions.outputs.update != 'true'
run: echo "No update required. Current version ${{ steps.versions.outputs.current }} is up to date with pixie-sdk ${{ steps.versions.outputs.latest }}."
- name: Align package and dependency versions
if: steps.versions.outputs.update == 'true'
run: |
set -euo pipefail
poetry version "${{ steps.versions.outputs.latest }}"
poetry add "pixie-sdk==${{ steps.versions.outputs.latest }}"
- name: Commit changes
if: steps.versions.outputs.update == 'true'
run: |
if git diff --quiet; then
echo "No file changes to commit."
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add pyproject.toml poetry.lock || true
git commit -m "chore: sync to pixie-sdk v${{ steps.versions.outputs.latest }}"
git push
- name: Trigger publish workflow
if: steps.versions.outputs.update == 'true'
run: |
gh workflow run version-bump-release.yml
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}