forked from termux-play-store/termux-packages
-
Notifications
You must be signed in to change notification settings - Fork 2
54 lines (51 loc) · 1.7 KB
/
docker_image.yml
File metadata and controls
54 lines (51 loc) · 1.7 KB
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
name: Docker image
on:
push:
branches:
- main
paths:
- 'scripts/Dockerfile'
- 'scripts/properties.sh'
- 'scripts/setup-android-sdk.sh'
- 'scripts/setup-ubuntu.sh'
workflow_dispatch:
jobs:
update:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
if: github.repository == 'termux-play-store/termux-packages'
steps:
- name: Clone repository
uses: actions/checkout@v6
- name: Build
run: |
docker build --tag termux-play-store/package-builder:latest scripts/
docker tag termux-play-store/package-builder:latest ghcr.io/termux-play-store/package-builder:latest
- name: Login to GHCR
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' && github.repository == 'termux-play-store/termux-packages'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Push
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' && github.repository == 'termux-play-store/termux-packages'
run: |
# ghcr.io seem to be unstable sometimes. It may suddenly drop connection
# during docker push when some layers are already uploaded. The workaround
# is to retry again 1 or 2 more times.
registry="ghcr.io/"
image=package-builder
for t in 1 2 3; do
if docker push "${registry}termux-play-store/${image}:latest"; then
break
else
if [ "$t" = "3" ]; then
echo "Giving up after 3 attempts"
exit 1
fi
sleep 20
fi
done