[AUTO] Patches auto-rebase for next-130 branch (#1555) #608
Workflow file for this run
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: Check git apply | |
permissions: | |
# actions: none | |
# checks: none | |
# contents: write | |
# deployments: none | |
# issues: none | |
# packages: none | |
pull-requests: write | |
# repository-projects: none | |
# security-events: none | |
# statuses: none | |
on: | |
push: | |
branches-ignore: | |
- 'ci' | |
paths: | |
- 'build/**' | |
workflow_dispatch: | |
inputs: | |
rtag: | |
description: 'uazo/cromite TAG or COMMIT' | |
required: true | |
default: '' | |
env: | |
RTAG: ${{ github.event.inputs.rtag }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Get value from dispatch" | |
run: | | |
if [ -z "${RTAG}" ]; then | |
echo "RTAG=$GITHUB_SHA" >> $GITHUB_ENV | |
echo "RTAG=$RTAG" | |
fi | |
- name: Prepare container | |
run: | | |
sudo apt update | |
sudo apt install -y wget unzip tar sed dos2unix patchutils wiggle curl | |
wget https://github.com/uazo/superpatch/releases/latest/download/SuperPatchUtils.tar.gz | |
tar xfz SuperPatchUtils.tar.gz | |
rm SuperPatchUtils.tar.gz | |
wget https://github.com/ericchiang/pup/releases/download/v0.4.0/pup_v0.4.0_linux_amd64.zip | |
unzip pup_v0.4.0_linux_amd64.zip | |
rm pup_v0.4.0_linux_amd64.zip | |
BRANCH=$(curl https://github.com/uazo/cromite/branch_commits/$RTAG | ./pup -p li.branch:last-child a text{}) | |
if [ -z "${BRANCH}" ]; then | |
BRANCH=$(curl https://github.com/uazo/cromite/branch_commits/$RTAG a | ./pup -p li.branch:first-child a text{}) | |
fi | |
if [ -z "${BRANCH}" ]; then | |
echo "Can not recover the base commit" | |
exit 1 | |
fi | |
echo "BRANCH=$BRANCH" >> $GITHUB_ENV | |
- name: Checkout 'uazo/cromite' ${{ env.BRANCH }} | |
uses: actions/checkout@v2 | |
with: | |
repository: 'uazo/cromite' | |
ref: ${{ github.event.inputs.rtag }} | |
path: 'cromite' | |
fetch-depth: 1 | |
- name: Check chromium version | |
run: | | |
export HOME=$GITHUB_WORKSPACE | |
VERSION=$(cat ~/cromite/build/RELEASE) | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Cache chromium sources | |
uses: actions/cache@v3 | |
with: | |
path: chromium-src | |
key: chrsource-${{ env.VERSION }} | |
- name: Download chromium ${{ env.VERSION }} sources | |
run: | | |
export HOME=$GITHUB_WORKSPACE | |
./bin/SuperPatchUtils bromite $RTAG ~/chromium-src | |
mkdir -p ~/chromium/src && cp -rT ~/chromium-src ~/chromium/src | |
cd ~/chromium/src | |
git init | |
git config user.email "[email protected]" | |
git config user.name "Your Name" | |
git add . | |
git commit -m $VERSION | |
git tag -a $VERSION -m $VERSION | |
git add -f v8 && git commit -m ":NOEXPORT: v8" || true | |
- name: Apply patches ${{ github.event.inputs.rtag }} | |
run: | | |
export HOME=$GITHUB_WORKSPACE | |
cd ~/chromium/src | |
export SILENT=true | |
export SKIPAUTOGENERATED=true | |
bash ~/cromite/tools/apply-all-patch.sh || exit 1 | |
rm -rf ~/cromite/build/patches-new/ | |
rm ~/cromite/build/cromite_patches_list_new.txt | |
- name: Export patches | |
run: | | |
export HOME=$GITHUB_WORKSPACE | |
cd ~/chromium/src | |
bash ~/cromite/tools/export-all-patch.sh | |
cd ~/cromite | |
rm -rf build/patches/* | |
mv build/patches-new/* build/patches | |
rm -rf build/patches-new/ | |
- name: Check differences CHANGES=${{ env.CHANGES }} | |
run: | | |
export HOME=$GITHUB_WORKSPACE | |
cd ~/cromite | |
CHANGES=0 && git diff --quiet || CHANGES=1 | |
echo "CHANGES=$CHANGES" >> $GITHUB_ENV | |
if [[ CHANGES -eq 1 ]]; then | |
git add build/patches/*.patch | |
git diff --name-only --staged | |
# MESSAGE=$(git diff --name-only --staged) | |
# echo "MESSAGE='$MESSAGE'" >> $GITHUB_ENV | |
fi | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c #v6.1.0 | |
if: env.CHANGES == '1' | |
with: | |
token: ${{ secrets.CROMITE_PULLS }} | |
path: cromite | |
base: ${{ env.BRANCH }} | |
#push-to-fork: uazo/cromite | |
add-paths: | | |
build/patches/*.patch | |
commit-message: '[AUTO] Patches auto-rebase' | |
title: '[AUTO] Patches auto-rebase for ${{ env.BRANCH }} branch' | |
body: ${{ env.MESSAGE }} | |
delete-branch: true | |
branch-suffix: short-commit-hash |