diff --git a/.github/workflows/publish-chrome.yaml b/.github/workflows/publish-chrome.yaml new file mode 100644 index 00000000..a108c37c --- /dev/null +++ b/.github/workflows/publish-chrome.yaml @@ -0,0 +1,69 @@ +name: Publish Chrome + +on: + workflow_dispatch: + inputs: + builder_ip: + description: "IP address of the builder" + required: true + type: string + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Configure SSH + run: | + mkdir -p ~/.ssh/ + echo "$SSH_KEY" > ~/.ssh/builder.key + chmod 600 ~/.ssh/builder.key + cat >>~/.ssh/config <> $GITHUB_OUTPUT + env: + SSH_HOST: ${{ inputs.builder_ip }} + + - name: Check + run: echo ${{ steps.get_version.outputs.chrome_version }} + +# - name: Set up Docker Buildx +# uses: docker/setup-buildx-action@v3 +# +# - name: Login to DockerHub +# uses: docker/login-action@v3 +# with: +# username: ${{ secrets.DOCKERHUB_USERNAME }} +# password: ${{ secrets.DOCKERHUB_TOKEN }} +# +# - name: Build and push +# uses: docker/build-push-action@v5 +# with: +# context: . +# file: ./build/chrome/Dockerfile +# push: true +# platforms: linux/amd64,linux/arm64 +# tags: ${{ steps.get_version.outputs.CHROME_VERSION }} diff --git a/build/chrome/scripts/build.sh b/build/chrome/scripts/build.sh new file mode 100644 index 00000000..e6a92afe --- /dev/null +++ b/build/chrome/scripts/build.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +sudo apt-get update +sudo apt-get install -y \ + apt-utils \ + build-essential \ + curl \ + git \ + python3 \ + sudo \ + zip +git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git +export PATH="$PATH:/home/chrome/depot_tools" +mkdir chromium +cd chromium || exit +fetch --nohooks --no-history chromium +echo 'solutions = [ + { + "name": "src", + "url": "https://chromium.googlesource.com/chromium/src.git", + "managed": False, + "custom_deps": {}, + "custom_vars": { + "checkout_pgo_profiles": True, + }, + "target_cpu": "arm64", + }, +]' | tee '.gclient' > /dev/null +cd src || exit +./build/install-build-deps.sh +./build/linux/sysroot_scripts/install-sysroot.py --arch=arm64 +gclient runhooks +gn gen out/default --args='target_cpu="arm64" proprietary_codecs=true ffmpeg_branding="Chrome" enable_nacl=false is_debug=false symbol_level=0 v8_symbol_level=0 dcheck_always_on=false is_official_build=true' +autoninja -C out/default chrome chrome_sandbox +cd out/default || exit +zip arm64.zip \ + chrome \ + chrome-wrapper \ + chrome_sandbox \ + chrome_100_percent.pak \ + chrome_200_percent.pak \ + chrome_crashpad_handler \ + headless_lib_data.pak \ + headless_lib_strings.pak \ + icudtl.dat \ + locales/en-US.pak \ + libEGL.so \ + libGLESv2.so \ + resources.pak \ + snapshot_blob.bin \ + v8_context_snapshot.bin diff --git a/build/chrome/scripts/create-user.sh b/build/chrome/scripts/create-user.sh new file mode 100644 index 00000000..ffa7b5ab --- /dev/null +++ b/build/chrome/scripts/create-user.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +useradd -m -d /home/chrome -s /bin/bash chrome +mkdir /home/chrome/.ssh +cp /root/.ssh/authorized_keys /home/chrome/.ssh/authorized_keys +chown -R chrome:chrome /home/chrome/.ssh +chmod 700 /home/chrome/.ssh +chmod 600 /home/chrome/.ssh/authorized_keys +adduser chrome sudo +sed -i '54i chrome ALL=(ALL:ALL) NOPASSWD: ALL' /etc/sudoers diff --git a/build/chrome/scripts/version.sh b/build/chrome/scripts/version.sh new file mode 100644 index 00000000..024019d9 --- /dev/null +++ b/build/chrome/scripts/version.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +version_full=$(tr '\n' ' ' < /home/chrome/chromium/src/chrome/VERSION) +version_delim="${version_full// /=}" + +IFS='=' +split=($version_delim) +unset IFS + +echo "${split[1]}.${split[3]}.${split[5]}.${split[7]}"