addpkg(main/turbopack): 16.1.6 #765
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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' | |
| - '.github/workflows/docker_image.yml' | |
| pull_request: | |
| paths: | |
| - 'scripts/Dockerfile' | |
| - 'scripts/properties.sh' | |
| - 'scripts/setup-android-sdk.sh' | |
| - 'scripts/setup-ubuntu.sh' | |
| - 'scripts/setup-cgct.sh' | |
| - '.github/workflows/docker_image.yml' | |
| 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@v6 | |
| # Skip building the Docker image on scheduled runs if the last successful | |
| # image build (the one tagged "latest") is less than IMAGE_MIN_INTERVAL_DAYS old. | |
| - name: Optionally skip building image | |
| if: github.event_name == 'schedule' | |
| id: skip-build | |
| env: | |
| IMAGE_MIN_INTERVAL_DAYS: 30 | |
| run: | | |
| LAST_TIMESTAMP=$(curl -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
| -H "Accept: application/vnd.github+json" \ | |
| "https://api.github.com/users/termux/packages/container/package-builder/versions" | | |
| jq --raw-output 'map(select(.metadata.container.tags | contains(["latest"])))[0].created_at') | |
| LAST_UNIX_TIME=$(date -d "$LAST_TIMESTAMP" +%s) | |
| CURRENT_UNIX_TIME=$(date +%s) | |
| if (( "$CURRENT_UNIX_TIME" - "$LAST_UNIX_TIME" < $IMAGE_MIN_INTERVAL_DAYS*24*60*60 )); then | |
| echo "Skipping building Docker image: last successful build was done on $LAST_TIMESTAMP (< $IMAGE_MIN_INTERVAL_DAYS days)" | |
| echo "skip-build=true" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Build | |
| if: ${{ steps.skip-build.outputs.skip-build != 'true' }} | |
| run: | | |
| docker build --tag termux/package-builder:latest scripts/ | |
| docker tag termux/package-builder:latest ghcr.io/termux/package-builder:latest | |
| - name: Build (CGCT) | |
| if: ${{ steps.skip-build.outputs.skip-build != 'true' }} | |
| run: | | |
| docker build --tag termux/package-builder-cgct:latest --file scripts/Dockerfile.cgct scripts/ | |
| 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' && steps.skip-build.outputs.skip-build != 'true' | |
| 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' && steps.skip-build.outputs.skip-build != 'true' | |
| 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' && steps.skip-build.outputs.skip-build != 'true' | |
| 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 |