8686 run : >-
8787 gh release upload
8888 '${{ github.ref_name }}' dist/**
89- --repo '${{ github.repository }}'
89+ --repo '${{ github.repository }}'
90+
91+ docker :
92+ name : Build Ubuntu-based Docker image
93+ needs : github-release
94+ runs-on : ubuntu-latest
95+ if : github.event_name != 'pull_request'
96+ steps :
97+ - name : Set image tag to release or branch
98+ run : echo "DOCKER_IMAGE_TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV
99+
100+ - name : If main, set to latest
101+ run : echo 'DOCKER_IMAGE_TAG=latest' >> $GITHUB_ENV
102+ if : env.DOCKER_IMAGE_TAG == 'main'
103+
104+ - name : Set Docker Hub repository to username
105+ run : echo "DOCKER_REPOSITORY=jbarlow83" >> $GITHUB_ENV
106+
107+ - name : Set image name
108+ run : echo "DOCKER_IMAGE_NAME=ocrmypdf-easyocr" >> $GITHUB_ENV
109+
110+ - uses : actions/checkout@v5
111+ with :
112+ fetch-depth : " 0" # 0=all, needed for setuptools-scm to resolve version tags
113+
114+ - name : Login to Docker Hub
115+ uses : docker/login-action@v3
116+ with :
117+ username : jbarlow83
118+ password : ${{ secrets.DOCKERHUB_TOKEN }}
119+
120+ - name : Set up Docker Buildx
121+ id : buildx
122+ uses : docker/setup-buildx-action@v3
123+
124+ - name : Print image tag
125+ run : echo "Building image ${DOCKER_REPOSITORY}/${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG}"
126+
127+ - name : Build
128+ run : |
129+ docker buildx build \
130+ --push \
131+ --platform linux/amd64 \
132+ --tag "${DOCKER_REPOSITORY}/${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG}" \
133+ --tag "${DOCKER_REPOSITORY}/${DOCKER_IMAGE_NAME}-ubuntu:${DOCKER_IMAGE_TAG}" \
134+ --file .docker/Dockerfile .
0 commit comments