Skip to content

Builds and pushes tagged image to DockerHub #536

Builds and pushes tagged image to DockerHub

Builds and pushes tagged image to DockerHub #536

Workflow file for this run

permissions:
actions: none
checks: none
contents: none
deployments: none
issues: write
packages: none
pull-requests: none
repository-projects: none
security-events: none
statuses: none
on:
workflow_dispatch:
inputs:
version:
description: 'chromium version'
required: false
default: ''
type:
description: 'runner?'
required: false
default: 'ubuntu-latest'
schedule:
- cron: '0 1 * * *'
env:
CHR_VERSION: ${{ github.event.inputs.version }}
NEW_VERSION: ${{ null }}
name: Builds and pushes tagged image to DockerHub
jobs:
generate_build_deps:
name: Generate Build Deps
runs-on: ${{ fromJSON( format('["ubuntu-latest", "{0}"]', github.event.inputs.type) )[github.event.inputs.type != ''] }}
steps:
- name: Reclaiming disk space on / by removing dotnet/android/ghc
#if: ${{ github.event.inputs.type == '' }}
run: |
df -h
DIR=/usr/share/dotnet && sudo rm -rf $DIR
DIR=/usr/local/lib/android && sudo rm -rf $DIR
DIR=/opt/ghc && sudo rm -rf $DIR
DIR=/opt/hostedtoolcache/CodeQL && sudo rm -rf $DIR
DIR=/usr/local/.ghcup && sudo rm -rf $DIR
DIR=/usr/lib/jvm && test -d $DIR && sudo rm -rf $DIR
DIR=/usr/local/julia1.10.5 && test -d $DIR && sudo rm -rf $DIR
DIR=/usr/local/x86_64-linux-gnu && test -d $DIR && sudo rm -rf $DIR
DIR=/usr/local/gcc && test -d $DIR && sudo rm -rf $DIR
DIR=/usr/local/llvm-15 && test -d $DIR && sudo rm -rf $DIR
DIR=/usr/local/llvm-14 && test -d $DIR && sudo rm -rf $DIR
DIR=/usr/local/llvm-13 && test -d $DIR && sudo rm -rf $DIR
DIR=/usr/local/heroku && test -d $DIR && sudo rm -rf $DIR
DIR=/usr/share/swift && test -d $DIR && sudo rm -rf $DIR
DIR=/usr/share/miniconda && test -d $DIR && sudo rm -rf $DIR
DIR=/usr/share/az_12.1.0 && test -d $DIR && sudo rm -rf $DIR
DIR=/usr/local/share/powershell && test -d $DIR && sudo rm -rf $DIR
DIR=/usr/local/share/chromium && test -d $DIR && sudo rm -rf $DIR
DIR=/usr/lib/gcc && test -d $DIR && sudo rm -rf $DIR
DIR=/usr/lib/llvm-15 && test -d $DIR && sudo rm -rf $DIR
DIR=/usr/lib/llvm-14 && test -d $DIR && sudo rm -rf $DIR
DIR=/usr/lib/llvm-13 && test -d $DIR && sudo rm -rf $DIR
sudo apt-get remove google-cloud-cli azure-cli google-chrome-stable \
firefox mysql-server-core-8.0 mono-devel podman \
powershell || true
sudo apt-get autoremove
df -h
- name: Enable proxy on container
shell: bash
if: ${{ github.event.inputs.type != '' && github.event.inputs.type != 'ubuntu-latest' }}
run: |
if ! [[ -z "${HTTP_PROXY}" ]]; then
PROXY_ADDR=http://$(hostname -I | cut -d' ' -f1 | xargs):8118
echo "PROXY_ADDR=$PROXY_ADDR" >> $GITHUB_ENV
sudo iptables -D INPUT -p tcp -s localhost --dport 8118 -j ACCEPT
sudo iptables -D INPUT -p tcp --dport 8118 -j DROP
fi
- name: Checkout repo
uses: actions/checkout@v2
with:
path: cromite
fetch-depth: 1
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Check versions
shell: bash
run: |
if [ -z $CHR_VERSION ]; then
LATEST_WIN=$(curl -s 'https://versionhistory.googleapis.com/v1/chrome/platforms/win64/channels/stable/versions/all/releases' | jq -rc '.releases[].version' | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n | tail -n 1)
LATEST_ANDROID=$(curl -s 'https://versionhistory.googleapis.com/v1/chrome/platforms/android/channels/stable/versions/all/releases' | jq -rc '.releases[].version' | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n | tail -n 1)
CHR_VERSION=$(echo -e "$LATEST_ANDROID\n$LATEST_WIN" | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n | tail -n 1)
echo "LATEST_WIN=$LATEST_WIN" >> $GITHUB_ENV
echo "LATEST_ANDROID=$LATEST_ANDROID" >> $GITHUB_ENV
echo "CHR_VERSION=$CHR_VERSION" >> $GITHUB_ENV
fi
- name: Building build-deps container ${{ env.VERSION }}
shell: bash
run: |
IS_PRESENT=$(docker inspect --type=image uazo/build-deps:$CHR_VERSION > /dev/null ; echo $?)
if [ $IS_PRESENT -ne "0" ]; then
IS_PRESENT=$(docker manifest inspect uazo/build-deps:$CHR_VERSION > /dev/null ; echo $?)
if [ $IS_PRESENT -ne "0" ]; then
DOCKER_BUILDKIT=1 docker build -t uazo/build-deps:$CHR_VERSION \
--progress plain \
--build-arg VERSION=$CHR_VERSION \
--build-arg HTTP_PROXY="$PROXY_ADDR" \
--no-cache \
cromite/tools/images/build-deps/.
docker push uazo/build-deps:$CHR_VERSION
echo "NEW_VERSION=$CHR_VERSION" >> $GITHUB_ENV
fi
fi
- name: Building chromium container ${{ env.VERSION }}
shell: bash
run: |
IS_PRESENT=$(docker inspect --type=image uazo/chromium:$CHR_VERSION > /dev/null ; echo $?)
if [ $IS_PRESENT -ne "0" ]; then
IS_PRESENT=$(docker manifest inspect uazo/chromium:$CHR_VERSION > /dev/null ; echo $?)
if [ $IS_PRESENT -ne "0" ]; then
DOCKER_BUILDKIT=1 docker build -t uazo/chromium:$CHR_VERSION \
--progress plain \
--build-arg VERSION=$CHR_VERSION \
--build-arg HTTP_PROXY="$PROXY_ADDR" \
cromite/tools/images/chr-source/.
docker push uazo/chromium:$CHR_VERSION
echo "NEW_VERSION=$CHR_VERSION" >> $GITHUB_ENV
fi
fi
- name: Update files under control
shell: bash
run: |
cd cromite
RELEASE=$(cat build/RELEASE | xargs)
cd tools/under-control
DO_UPDATE=0
if [ -n "$NEW_VERSION" ]; then
if [ "$RELEASE" != "$NEW_VERSION" ]; then
DO_UPDATE=1
fi
elif [ "$RELEASE" != "$(cat src/RELEASE | xargs)" ]; then
DO_UPDATE=1
NEW_VERSION=$RELEASE
fi
if [[ DO_UPDATE -eq 1 ]]; then
echo "Found new version $NEW_VERSION"
echo "Under control: $(cat src/RELEASE | xargs)"
echo "Current: $RELEASE"
test -d src && rm -rf src
docker build --progress=plain --build-arg "TAG=$NEW_VERSION" -o . .
echo $NEW_VERSION >src/RELEASE
fi
CHANGES=0 && git diff --quiet || CHANGES=1
echo "CHANGES=$CHANGES" >> $GITHUB_ENV
if [[ CHANGES -eq 1 ]]; then
git add src
git diff --name-only --staged
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
add-paths: |
tools/under-control/*
commit-message: '[AUTO][FILECONTROL] - version ${{ env.NEW_VERSION }}'
title: '[AUTO][FILECONTROL] - version ${{ env.NEW_VERSION }}'
body: ${{ env.MESSAGE }}
delete-branch: true
branch-suffix: short-commit-hash
- name: Create issue ${{ env.VERSION }}
if: "${{ env.NEW_VERSION != '' }}"
shell: bash
run: |
GH=../../gh_2.18.1_linux_amd64/bin/gh
wget https://github.com/cli/cli/releases/download/v2.18.1/gh_2.18.1_linux_amd64.tar.gz
tar xfz gh_2.18.1_linux_amd64.tar.gz
cd cromite/tools
echo ${{ secrets.GITHUB_TOKEN }} | $GH auth login --with-token
echo Custom Release $CHR_VERSION >body.txt
if [[ "$LATEST_WIN" == "$CHR_VERSION" ]]; then
echo Using Windows Release >body.txt
echo "\`\`\`" >>body.txt
curl -s 'https://chromiumdash.appspot.com/fetch_releases?channel=Stable&platform=Windows&num=10&offset=0' | \
jq --arg LATEST "$LATEST_WIN" '.[] | select( .version == $LATEST )' >>body.txt
echo "\`\`\`" >>body.txt
fi
if [[ "$LATEST_ANDROID" == "$CHR_VERSION" ]]; then
echo Using Android Release >body.txt
echo "\`\`\`" >>body.txt
curl -s 'https://chromiumdash.appspot.com/fetch_releases?channel=Stable&platform=Android&num=10&offset=0' | \
jq --arg LATEST "$LATEST_ANDROID" '.[] | select( .version == $LATEST )' >>body.txt
echo "\`\`\`" >>body.txt
fi
$GH issue create -t "$CHR_VERSION: new chromium version" -F body.txt