-
Notifications
You must be signed in to change notification settings - Fork 43
62 lines (62 loc) · 2.09 KB
/
cargo-upgrade.yml
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
name: cargo-upgrade
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * 0" # At 00:00 on Sunday
env:
CARGO_TERM_COLOR: always
ACTION_MSRV_TOOLCHAIN: 1.66.1
BODY_FILE: .cargo-upgrades
jobs:
upgrade:
if: github.ref == 'refs/heads/main' && github.repository == 'containers/conmon-rs'
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Setup Cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-upgrade-${{ hashFiles('**/Cargo.lock') }}
- name: Select latest toolchain
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7
with:
toolchain: stable
default: true
override: true
- name: Install cargo-edit
run: cargo install cargo-edit
- name: Upgrade direct dependencies
shell: bash
run: |
set -euox pipefail
mv .cargo .tmp
printf "Update cargo dependencies:\n\n\`\`\`\n" > "$BODY_FILE"
cargo upgrade --rust-version=$ACTION_MSRV_TOOLCHAIN >> "$BODY_FILE"
echo "\`\`\`" >> "$BODY_FILE"
mv .tmp .cargo
cargo vendor .cargo-vendor
- name: Check workspace
id: create_pr
run: |
if [[ $(git diff --stat) != '' ]]; then
echo "create_pr=true" >> "$GITHUB_OUTPUT"
fi
- name: Create PR if required
uses: peter-evans/create-pull-request@8867c4aba1b742c39f8d0ba35429c2dfa4b6cb20 # v7.0.1
if: ${{ steps.create_pr.outputs.create_pr == 'true' }}
with:
commit-message: Update cargo dependencies
title: "Update cargo dependencies"
body-path: ${{ env['BODY_FILE'] }}
labels: kind/dependency-change, release-note-none, ok-to-test
branch: cargo-deps
delete-branch: true
signoff: true