mirror of
https://github.com/termux/termux-packages
synced 2024-06-19 00:37:07 +00:00
ghcr.io sometimes drops connection when image is pushed from GitHub Actions. I never observed that behavior when pushing the image built locally, so don't know what triggers that issue. The workaround is to just try pushing the image again.
60 lines
1.8 KiB
YAML
60 lines
1.8 KiB
YAML
name: Docker image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
paths:
|
|
- 'scripts/Dockerfile'
|
|
- 'scripts/properties.sh'
|
|
- 'scripts/setup-android-sdk.sh'
|
|
- 'scripts/setup-ubuntu.sh'
|
|
schedule:
|
|
- cron: '0 2 * * 0'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
update:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
steps:
|
|
- name: Clone repository
|
|
uses: actions/checkout@v3
|
|
- name: Build
|
|
run: |
|
|
cd ./scripts
|
|
docker build --tag termux/package-builder:latest .
|
|
docker tag termux/package-builder:latest ghcr.io/termux/package-builder:latest
|
|
- name: Login to GHCR
|
|
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request' && github.repository == 'termux/termux-packages'
|
|
uses: docker/login-action@v1
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Login to Docker Hub
|
|
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request' && github.repository == 'termux/termux-packages'
|
|
uses: docker/login-action@v1
|
|
with:
|
|
username: grimler
|
|
password: ${{ secrets.DOCKER_TOKEN }}
|
|
- name: Push
|
|
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request' && github.repository == 'termux/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.
|
|
for t in 1 2 3; do
|
|
if docker push "ghcr.io/termux/package-builder:latest"; then
|
|
break
|
|
else
|
|
if [ "$t" = "3" ]; then
|
|
exit 1
|
|
fi
|
|
fi
|
|
done
|
|
|
|
docker push termux/package-builder:latest
|