cargo-upgrade #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 | |
- name: Setup Cache | |
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: cargo-upgrade-${{ hashFiles('**/Cargo.lock') }} | |
- name: Select latest toolchain | |
uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a | |
with: | |
toolchain: stable | |
- 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@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5 | |
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 |