forked from verus-lang/verus
-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (67 loc) · 2.41 KB
/
Copy pathcrate-updates.yml
File metadata and controls
79 lines (67 loc) · 2.41 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
name: crate-updates
on:
schedule:
- cron: '0 0 * * 0' # Runs on main by default every Sunday
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
bump-crate-versions:
runs-on: ubuntu-24.04
if: github.repository == 'verus-lang/verus'
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
token: ${{ secrets.CRATES_UPDATE_TOKEN }}
- name: Setup Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.97.1
- name: Configure git
run: |
git config --global user.name 'Version Bumper Bot'
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
BRANCH="bot/crate-updates-$(date +%Y%m%d)-${{ github.run_number }}"
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
git checkout -b $BRANCH
- name: Update crate versions, if needed
run: |
cargo run --manifest-path source/tools/bump_crate_versions/Cargo.toml update
- name: Commit version updates
run: |
if ! git diff-index --quiet HEAD; then
git commit -am "Update crate version numbers"
echo "CHANGED=true" >> $GITHUB_ENV
else
echo "No version updates needed"
fi
- name: Publish updated crates to crates.io
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
cargo run --manifest-path source/tools/bump_crate_versions/Cargo.toml publish
- name: Update Cargo.lock, if needed
run: |
pushd source; cargo update verus_builtin verus_builtin_macros verus_prettyplease verus_state_machines_macros verus_syn; popd
- name: Commit updated lock file
run: |
if ! git diff-index --quiet HEAD; then
git commit -am "Update Cargo.lock"
echo "CHANGED=true" >> $GITHUB_ENV
else
echo "No Cargo.lock update needed"
fi
- name: Push branch and open PR
if: env.CHANGED == 'true'
env:
GH_TOKEN: ${{ secrets.CRATES_UPDATE_TOKEN }}
run: |
git push origin $BRANCH
gh pr create \
--title "Update crate version numbers" \
--body "Automated weekly crate version and Cargo.lock updates." \
--base main
gh pr merge --auto --merge