karellen-manylinux-update #1839
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: karellen-manylinux-update | |
on: | |
schedule: | |
- cron: "0 */1 * * *" | |
workflow_dispatch: | |
jobs: | |
check-update: | |
runs-on: linux | |
timeout-minutes: 600 | |
continue-on-error: false | |
env: | |
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 60 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.PAT_TOKEN }} | |
- name: Check Updates | |
shell: bash | |
run: | | |
set -eEux | |
set -o pipefail | |
shopt -s extglob | |
MODULES_CHANGED="" | |
while read line; do | |
read -r SUBMODULE_SHA SUBMODULE_NAME SUBMODULE_DESCRIBE <<<"$line" | |
# The submodules here are not initialized so there'll be a '-' in front of the local SHA | |
SUBMODULE_SHA=${SUBMODULE_SHA:1} | |
GIT_CONFIG="$(git config -f .gitmodules -l | grep 'submodule.'$SUBMODULE_NAME.)" | |
SUBMODULE_URL="$(echo "$GIT_CONFIG" | grep 'submodule.'$SUBMODULE_NAME'.url=' | sed 's/submodule\.'$SUBMODULE_NAME'\.url=//')" | |
SUBMODULE_BRANCH="$(echo "$GIT_CONFIG" | grep 'submodule.'$SUBMODULE_NAME'.branch=' | sed 's/submodule\.'$SUBMODULE_NAME'\.branch=//')" | |
read -r REMOTE_SHA REMOTE_REF <<<"$(git ls-remote $SUBMODULE_URL | grep 'refs/heads/'$SUBMODULE_BRANCH)" | |
if [ "$SUBMODULE_SHA" != "$REMOTE_SHA" ]; then | |
echo "## Submodule $SUBMODULE_NAME @ $SUBMODULE_URL/tree/$SUBMODULE_BRANCH local $SUBMODULE_SHA vs remote $REMOTE_SHA" >> $GITHUB_STEP_SUMMARY | |
MODULES_CHANGED="1" | |
else | |
echo "## Submodule $SUBMODULE_NAME @ $SUBMODULE_URL/tree/$SUBMODULE_BRANCH local $SUBMODULE_SHA unchanged" >> $GITHUB_STEP_SUMMARY | |
fi | |
done <<< "$(git submodule status)" | |
git submodule sync --recursive | |
git submodule update --init --remote --recursive | |
./patch_build_yml.sh | |
if [ -z "$MODULES_CHANGED" -a -z "$(git status --porcelain)" ]; then | |
echo "# No submodule or other changed detected - exiting!" >> $GITHUB_STEP_SUMMARY | |
exit 0 | |
fi | |
git config --global user.email "supervisor@karellen.co" | |
git config --global user.name "Karellen Supervisor" | |
git add \* | |
git commit -a -m "Update $(date -u +"%Y-%m-%dT%H:%M:%SZ")" | |
git push --follow-tags |