-
Notifications
You must be signed in to change notification settings - Fork 4
66 lines (56 loc) · 2.21 KB
/
auto-update-pyrefly.yml
File metadata and controls
66 lines (56 loc) · 2.21 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
name: Auto-update Pyrefly Version
on:
workflow_dispatch:
schedule:
# Run daily at 10:00 UTC to check for new pyrefly releases
- cron: '0 10 * * *'
jobs:
update-pyrefly:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Get versions to update
id: get-versions
run: |
# Get current version from pyproject.toml
CURRENT_VERSION=$(grep -oP 'pyrefly==\K[0-9.]+' pyproject.toml)
echo "Current version: $CURRENT_VERSION"
echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
# Install packaging library and run script
python -m pip install --quiet packaging
VERSIONS_TO_UPDATE=$(python get_versions.py "$CURRENT_VERSION")
if [ -z "$VERSIONS_TO_UPDATE" ]; then
echo "No updates needed - already at latest version"
echo "versions_list=" >> $GITHUB_OUTPUT
echo "needs_update=false" >> $GITHUB_OUTPUT
else
echo "Versions to update: $VERSIONS_TO_UPDATE"
echo "versions_list=$VERSIONS_TO_UPDATE" >> $GITHUB_OUTPUT
echo "needs_update=true" >> $GITHUB_OUTPUT
fi
- name: Configure Git
if: steps.get-versions.outputs.needs_update == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Update to each version
if: steps.get-versions.outputs.needs_update == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSIONS="${{ steps.get-versions.outputs.versions_list }}"
CURRENT_VERSION="${{ steps.get-versions.outputs.current_version }}"
# Run the update script
./update-versions.sh "$CURRENT_VERSION" $VERSIONS
# Push all commits and tags at once
echo "Pushing all commits and tags..."
git push origin ${{ github.ref_name }}
git push origin --tags