mirror of
https://github.com/termux/termux-packages.git
synced 2025-03-04 07:08:58 +00:00
Turns out our CI scripts that git push stuff do use credentials from the checkout script. Revert until we configure scripts to use a token instead. This reverts commit b57505f341cf2f9bfc09b0b19c5b911efb274deb.
68 lines
2.3 KiB
YAML
68 lines
2.3 KiB
YAML
name: Docker image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
paths:
|
|
- 'scripts/Dockerfile'
|
|
- 'scripts/properties.sh'
|
|
- 'scripts/setup-android-sdk.sh'
|
|
- 'scripts/setup-ubuntu.sh'
|
|
- 'scripts/setup-cgct.sh'
|
|
schedule:
|
|
- cron: '0 2 * * 0'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
update:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
if: github.repository == 'termux/termux-packages'
|
|
steps:
|
|
- name: Clone repository
|
|
uses: actions/checkout@v4
|
|
- name: Build
|
|
run: |
|
|
cd ./scripts
|
|
docker build --tag termux/package-builder:latest .
|
|
docker tag termux/package-builder:latest ghcr.io/termux/package-builder:latest
|
|
docker build --tag termux/package-builder-cgct:latest --file Dockerfile.cgct .
|
|
docker tag termux/package-builder-cgct:latest ghcr.io/termux/package-builder-cgct: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@v3
|
|
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@v3
|
|
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 registry in "ghcr.io/" ""; do
|
|
for image in package-builder package-builder-cgct; do
|
|
for t in 1 2 3; do
|
|
if docker push "${registry}termux/${image}:latest"; then
|
|
break
|
|
else
|
|
if [ "$t" = "3" ]; then
|
|
echo "Giving up after 3 attempts"
|
|
exit 1
|
|
fi
|
|
sleep 20
|
|
fi
|
|
done
|
|
done
|
|
done
|