Skip to content

Add Action for automated Updates of Geth and Prysm #1

Add Action for automated Updates of Geth and Prysm

Add Action for automated Updates of Geth and Prysm #1

name: Check for submodule releases
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
check-submodule-release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: false # We'll handle submodule updates manually
- 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"
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/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_PRYSM_RELEASE" != "$CURRENT_TAG" ]]; then
echo "There's a new release for the submodule: $LATEST_PRYSM_RELEASE"
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 }}