Update openvm rev in dependencies #13
This file contains hidden or 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: "Update openvm rev in dependencies" | |
# Warning: this workflow will only work if openvm has also been updated in revm | |
# Otherwise, use the update-patches.yml workflow instead | |
on: | |
workflow_dispatch: | |
inputs: | |
OPENVM_REV: | |
description: "New openvm rev (defaults to main head)" | |
required: false | |
jobs: | |
update: | |
name: "Update workspace and guest Cargo.toml and open a pull request" | |
runs-on: | |
- ubuntu-latest | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v4 | |
- name: Get default OPENVM_REV from main (if none provided) | |
id: get-openvm-rev | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
if ("${{ github.event.inputs.OPENVM_REV }}" !== "") { | |
// If provided by user, simply return it | |
return "${{ github.event.inputs.OPENVM_REV }}"; | |
} else { | |
// Otherwise fetch latest commit of main | |
const { data } = await github.rest.repos.getCommit({ | |
owner: 'openvm-org', | |
repo: 'openvm', | |
ref: 'main' | |
}); | |
return data.sha; | |
} | |
- name: Find & replace rev in all Cargo.toml files | |
run: | | |
OPENVM_REV=${{ steps.get-openvm-rev.outputs.result }} | |
OLD_REV=$(grep '^openvm = { git = "https://github.com/openvm-org/openvm.git"' Cargo.toml | sed -E 's/.*rev = "([^"]+)".*/\1/') | |
bash ci/update_rev.sh $OLD_REV $OPENVM_REV | |
- name: Update workspace Cargo.lock | |
run: | | |
cargo update -p openvm-sdk | |
cargo update -p openvm-stark-sdk | |
cargo tree | |
- name: Update guest Cargo.lock | |
working-directory: bin/client-eth | |
run: | | |
cargo update -p openvm | |
cargo update -p revm | |
cargo tree | |
- name: Configure git | |
run: | | |
git config user.name "${{ github.actor }}" | |
git config user.email "${{ github.actor }}@users.noreply.github.com" | |
- name: Create or update branch | |
run: | | |
BRANCH_NAME="update-openvm-$(date +%Y%m%d%H%M%S)" | |
git checkout -b "$BRANCH_NAME" | |
git add -f Cargo.lock | |
git add -f Cargo.toml | |
git add -f bin/client-eth/Cargo.lock | |
git add -f bin/client-eth/Cargo.toml | |
git commit -m "Update openvm commits in dependencies" | |
git push -u origin "$BRANCH_NAME" | |
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV | |
- name: Create pull request | |
uses: repo-sync/pull-request@v2 | |
with: | |
source_branch: ${{ env.BRANCH_NAME }} | |
destination_branch: ${{ github.ref_name }} | |
pr_title: "Update openvm to ${{ steps.get-openvm-rev.outputs.result }}" | |
pr_body: | | |
This pull request updates Cargo dependencies using: | |
- OPENVM_REV = ${{ steps.get-openvm-rev.outputs.result }} | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
id: create-pr-branch |