Skip to content

enhance(ci): generate, export, store tar archive (#61) #296

enhance(ci): generate, export, store tar archive (#61)

enhance(ci): generate, export, store tar archive (#61) #296

Workflow file for this run

name: Build and push Docker image
on:
push:
branches:
- master
pull_request:
schedule:
- cron: '0 2 * * 0'
workflow_dispatch:
env:
CI: true
DOCKER_BUILDKIT: 1
jobs:
main:
runs-on: ubuntu-latest
strategy:
matrix:
CPU_ARCH:
- aarch64
- arm
- i686
- x86_64
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Setup binfmt_misc
if: (matrix.CPU_ARCH == 'aarch64') || (matrix.CPU_ARCH == 'arm')
run: docker run --rm --privileged aptman/qus -s -- -p aarch64 arm
- name: Build images
run: |
case '${{ matrix.CPU_ARCH }}' in
arm) SYSTEM_TYPE=arm; PLATFORM_TAG="linux/arm/v7";;
aarch64) SYSTEM_TYPE=arm; PLATFORM_TAG="linux/arm64";;
i686) SYSTEM_TYPE=x86; PLATFORM_TAG="linux/386";;
*) SYSTEM_TYPE=x86; PLATFORM_TAG="linux/amd64";;
esac
docker buildx build -t \
termux/termux-docker:${{ matrix.CPU_ARCH }} \
--platform "$PLATFORM_TAG" \
--build-arg BOOTSTRAP_ARCH=${{ matrix.CPU_ARCH }} \
--build-arg SYSTEM_TYPE="${SYSTEM_TYPE}" \
.
- name: Login to Docker Hub
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request' && github.repository == 'termux/termux-docker'
uses: docker/login-action@v3
with:
username: grimler
password: ${{ secrets.GRIMLER_DOCKER_TOKEN }}
- name: Push to Docker Hub
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request' && github.repository == 'termux/termux-docker'
run: |
docker push termux/termux-docker:${{ matrix.CPU_ARCH }}
if [ ${{ matrix.CPU_ARCH }} = i686 ]; then
docker tag termux/termux-docker:i686 termux/termux-docker:latest
docker push termux/termux-docker:latest
fi
- name: Export container as tar archive
if: always()
run: |
docker run \
--privileged \
--name termux-docker-${{ matrix.CPU_ARCH }} \
termux/termux-docker:${{ matrix.CPU_ARCH }} \
uname -a
docker stop termux-docker-${{ matrix.CPU_ARCH }}
docker export -o termux-docker-${{ matrix.CPU_ARCH }}.tar \
termux-docker-${{ matrix.CPU_ARCH }}
sha256sum termux-docker-${{ matrix.CPU_ARCH }}.tar
- name: Store tar archive
if: always()
uses: actions/upload-artifact@v4
with:
name: termux-docker-${{ matrix.CPU_ARCH }}-${{ github.sha }}
path: termux-docker-${{ matrix.CPU_ARCH }}.tar