forked from bromite/bromite
-
Notifications
You must be signed in to change notification settings - Fork 105
144 lines (128 loc) · 5.68 KB
/
build-images.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
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: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo apt-get remove google-cloud-cli azure-cli google-chrome-stable \
firefox mysql-server-core-8.0 mono-devel podman \
powershell
sudo apt-get autoremove
- name: Enable proxy on container
shell: bash
if: ${{ 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: 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
if [[ "$LATEST_WIN" == "$CHR_VERSION" ]]; then
echo Using Windows Release >>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
fi
if [[ "$LATEST_ANDROID" == "$CHR_VERSION" ]]; then
echo Using Android Release >>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
fi
$GH issue create -t "$CHR_VERSION: new chromium version" -F body.txt