Files
helium/.github/actions/bump-platform/action.yml

102 lines
2.9 KiB
YAML

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: Clear disk space
shell: bash
run: |
sudo rm -rf /usr/lib/jvm \
/usr/lib/google-cloud-sdk \
/usr/lib/dotnet \
/usr/share/swift
- 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}
for file in "$HELIUM_DIR/downloads.ini" "$HELIUM_DIR/extras.ini" "$PLATFORM_DIR/downloads.ini"; do
if ! [ -f "$file" ]; then continue; fi
run_upstream utils/downloads.py retrieve \
-i "$file" -c build/download_cache
run_upstream utils/downloads.py unpack \
-i "$file" -c build/download_cache build/src
done
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 $version_after"
git config user.name "helium-bot"
git config user.email "helium-bot@imput.net"
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