bromite-buildtools/.github/workflows/check_git_apply.yaml

113 lines
3.6 KiB
YAML
Raw Normal View History

2022-10-28 14:38:14 +05:30
name: Check git apply
on:
workflow_dispatch:
inputs:
rtag:
description: 'uazo/bromite TAG or COMMIT'
required: true
default: ''
env:
GITHUB_SHA: ${{ github.event.inputs.rtag }}
jobs:
build:
runs-on: ci
steps:
- 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
git clone https://github.com/uazo/bromite-buildtools
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/bromite/branch_commits/$GITHUB_SHA | ./pup -p li.branch:last-child a text{})
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
- name: Checkout 'uazo/bromite' ${{ env.BRANCH }}
uses: actions/checkout@v2
with:
repository: 'uazo/bromite'
ref: ${{ github.event.inputs.rtag }}
path: 'bromite'
fetch-depth: 1
- name: Check chromium version
run: |
VERSION=$(cat bromite/build/RELEASE)
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Download chromium ${{ env.VERSION }} sources
run: |
./bin/SuperPatchUtils bromite $GITHUB_SHA chromium/src
cd chromium/src
git init
git config user.email "you@example.com"
git config user.name "Your Name"
git add .
git commit -m $VERSION
git tag -a $VERSION -m $VERSION
cd ../..
- name: Apply patches ${{ github.event.inputs.rtag }}
run: |
export HOME=$(pwd)
cd ~/chromium/src
export SILENT=true
export CGA_REMOTE=true
export SKIPAUTOGENERATED=true
bash ~/bromite-buildtools/apply-all-patch.sh || sleep 23h
rm -rf ~/bromite/build/patches-new/
rm ~/bromite/build/bromite_patches_list_new.txt
- name: Export patches
run: |
export HOME=$(pwd)
cd ~/chromium/src
bash ~/bromite-buildtools/export-all-patch.sh
cd ~/bromite
rm -rf build/patches/*
mv build/patches-new/* build/patches
rm -rf build/patches-new/
- name: Check differences CHANGES=${{ env.CHANGES }}
run: |
cd bromite
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@dcd5fd746d53dd8de555c0f10bca6c35628be47a #v3.12.0
if: env.CHANGES == '1'
with:
path: bromite
base: ${{ env.BRANCH }}
#push-to-fork: uazo/bromite
add-paths: |
build/patches/*.patch
commit-message: 'AUTOMATED - git apply results'
title: Git apply result for ${{ env.BRANCH }} branch
body: ${{ env.MESSAGE }}
delete-branch: true
branch-suffix: short-commit-hash