mirror of
https://github.com/morgan9e/helium
synced 2026-04-15 00:44:06 +09:00
ci: add action for bumping platform repos
This commit is contained in:
90
.github/actions/bump-platform/action.yml
vendored
Normal file
90
.github/actions/bump-platform/action.yml
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
name: Bump platform revision
|
||||
description: Refreshes patches, updates the platform revision and submodule
|
||||
|
||||
inputs:
|
||||
token:
|
||||
description: 'GitHub access token'
|
||||
required: true
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Prepare
|
||||
shell: bash
|
||||
run: sudo apt install quilt
|
||||
|
||||
- name: Bump revision and make PR
|
||||
shell: bash
|
||||
env:
|
||||
GH_TOKEN: ${{ inputs.token }}
|
||||
run: |
|
||||
set -euxo pipefail
|
||||
|
||||
PLATFORM_DIR="$PWD"
|
||||
HELIUM_DIR="$PLATFORM_DIR/helium-chromium"
|
||||
|
||||
run_upstream() {
|
||||
python3 "$HELIUM_DIR/$1" "${@:2}"
|
||||
}
|
||||
|
||||
get_version() {
|
||||
run_upstream utils/helium_version.py \
|
||||
--tree "$HELIUM_DIR" \
|
||||
--platform-tree "$PLATFORM_DIR" \
|
||||
--print
|
||||
}
|
||||
|
||||
# get versions and compare them after submodule update
|
||||
version_before=$(get_version)
|
||||
|
||||
pushd "$HELIUM_DIR"
|
||||
git fetch origin main
|
||||
git checkout origin/main
|
||||
popd
|
||||
|
||||
git switch update || git switch -c update
|
||||
version_after=$(get_version)
|
||||
|
||||
# reset or bump revision counter depending on version change
|
||||
if [ "$version_before" != "$version_after" ]; then
|
||||
echo "main version changed, resetting platform revision"
|
||||
echo 1 > "$PLATFORM_DIR/revision.txt"
|
||||
else
|
||||
echo "no change in main version, bumping platform revision"
|
||||
revision=$(cat "$PLATFORM_DIR/revision.txt")
|
||||
echo $((revision + 1)) > "$PLATFORM_DIR/revision.txt"
|
||||
fi
|
||||
|
||||
version_after=$(get_version)
|
||||
|
||||
mkdir -p build/{src,download_cache}
|
||||
|
||||
# fetch soures, expect that patches apply cleanly (or die)
|
||||
run_upstream utils/downloads.py retrieve \
|
||||
-i "$HELIUM_DIR/downloads.ini" -c build/download_cache
|
||||
|
||||
run_upstream utils/downloads.py unpack \
|
||||
-i "$HELIUM_DIR/downloads.ini" -c build/download_cache build/src
|
||||
|
||||
run_upstream utils/patches.py apply \
|
||||
--no-fuzz build/src "$HELIUM_DIR/patches"
|
||||
|
||||
# refresh platform patches if necessary
|
||||
source "$HELIUM_DIR/devutils/set_quilt_vars.sh"
|
||||
export QUILT_PATCHES="$PLATFORM_DIR/patches"
|
||||
|
||||
pushd build/src
|
||||
quilt --quiltrc - push -a --refresh
|
||||
popd
|
||||
|
||||
# commit, push, make pr
|
||||
TITLE="update: helium-chromium $version_after"
|
||||
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git add -u patches helium-chromium revision.txt
|
||||
if ! git status | tail -1 | grep -q 'nothing to commit'; then
|
||||
git commit -m "$TITLE"
|
||||
git push origin update
|
||||
gh pr create --title "$TITLE" --body "" || :
|
||||
fi
|
||||
Reference in New Issue
Block a user