Skip to content

Add Action for automated Updates of Geth and Prysm #5

Add Action for automated Updates of Geth and Prysm

Add Action for automated Updates of Geth and Prysm #5

name: Check for submodule releases
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
check-submodule-releases:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Check for new submodule release of go-ethereum
run: |
# Fetch the latest release tag from the submodule repo using the GitHub API
LATEST_GETH_RELEASE=$(curl -s https://api.github.com/repos/ethereum/go-ethereum/releases/latest | jq -r .tag_name)
cd ./dependencies/go-ethereum
# Fetch and check the current checked-out tag for the submodule
git fetch
CURRENT_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
if [[ "$LATEST_GETH_RELEASE" != "$CURRENT_TAG" ]]; then
echo "There's a new release for the submodule: $LATEST_GETH_RELEASE (current is $CURRENT_TAG)"
echo "LATEST_GETH_RELEASE=$LATEST_GETH_RELEASE" >> $GITHUB_ENV
echo "NEW_GETH_UPDATE=true" >> $GITHUB_ENV
fi
- name: Update Geth submodule to new release
if: env.NEW_GETH_UPDATE == 'true'
run: |
cd ./dependencies/go-ethereum
git checkout ${{ env.LATEST_GETH_RELEASE }}
- name: Create PR for Geth submodule update
if: env.NEW_GETH_UPDATE == 'true'
uses: peter-evans/create-pull-request@v3
with:
title: Update Geth submodule to ${{ env.LATEST_GETH_RELEASE }}
commit-message: Update Geth submodule to ${{ env.LATEST_GETH_RELEASE }}
branch: update-submodule-to-${{ env.LATEST_GETH_RELEASE }}
- name: Check for new submodule release of prysm
run: |
# Fetch the latest release tag from the submodule repo using the GitHub API
LATEST_PRYSM_RELEASE=$(curl -s https://api.github.com/repos/ethereum/go-ethereum/releases/latest | jq -r .tag_name)
cd ./dependencies/prysm
# Fetch and check the current checked-out tag for the submodule
git fetch
CURRENT_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
if [[ "$LATEST_PRYSM_RELEASE" != "$CURRENT_TAG" ]]; then
echo "There's a new release for the submodule: $LATEST_PRYSM_RELEASE (current is $CURRENT_TAG)"
echo "LATEST_PRYSM_RELEASE=$LATEST_PRYSM_RELEASE" >> $GITHUB_ENV
echo "NEW_PRYSM_UPDATE=true" >> $GITHUB_ENV
fi
- name: Update Prysm submodule to new release
if: env.NEW_PRYSM_UPDATE == 'true'
run: |
cd ./dependencies/prysm
git checkout ${{ env.LATEST_PRYSM_RELEASE }}
- name: Create PR for Prysm submodule update
if: env.NEW_PRYSM_UPDATE == 'true'
uses: peter-evans/create-pull-request@v3
with:
title: Update Prysm submodule to ${{ env.LATEST_PRYSM_RELEASE }}
commit-message: Update Prysm submodule to ${{ env.LATEST_PRYSM_RELEASE }}
branch: update-submodule-to-${{ env.LATEST_PRYSM_RELEASE }}