@@ -2,11 +2,11 @@ name: build
22
33on :
44 push :
5- branches : [ main, release-13.0.x, release-12.0.x, release-11.6.x, release-11.5.x, task/*_compatibility ]
5+ branches : [ main, release-13.0.x, release-12.0.x, task/*_compatibility ]
66 tags :
77 - " **"
88 pull_request :
9- branches : [ main, release-13.0.x, release-12.0.x, release-11.6.x, release-11.5.x, task/*_compatibility ]
9+ branches : [ main, release-13.0.x, release-12.0.x, task/*_compatibility ]
1010
1111 # Run tests daily at 19:23 to get TYPO3 changes and fix them immediately.
1212 # @todo:
1717
1818env :
1919 IS_ON_GITHUB_ACTIONS : ' true'
20+ IS_LATEST_VERSION : ' true'
2021 CI_BUILD_DIRECTORY : ' /home/runner/work/ext-solr/ext-solr/.Build'
2122 LOCAL_IMAGE_NAME : ' solrci-image:latest'
2223 LOCAL_CONTAINER_NAME : ' solrci-container'
@@ -202,6 +203,83 @@ jobs:
202203 ${{ env.CI_BUILD_DIRECTORY }}/data-mysql \
203204 ${{ env.CI_BUILD_DIRECTORY }}/data-solr
204205
206+ publish-docker-hub :
207+ name : Publish docker-image to docker-hub
208+ needs : tests
209+ if : |
210+ (
211+ github.ref == 'refs/heads/main' ||
212+ startsWith(github.ref, 'refs/heads/release-') ||
213+ startsWith(github.ref, 'refs/tags/')
214+ )
215+ runs-on : ubuntu-latest
216+ env :
217+ DOCKER_PLATFORMS : " linux/amd64,linux/arm64,linux/ppc64le"
218+ DOCKER_HUB_IMAGE_NAME : " ${{ secrets.DOCKERHUB_USERNAME }}/ext-solr"
219+ steps :
220+ - name : Checkout
221+ uses : actions/checkout@v4
222+
223+ - name : enrich Environment Variables
224+ id : env
225+ run : |
226+ echo "NOW=$(date +'%F %Z %T')" >> $GITHUB_ENV
227+ echo "BRANCH_TAG=$(jq -r '.extra."branch-alias" | to_entries | .[0].key' composer.json)" >> $GITHUB_ENV
228+ echo "BRANCH_ALIAS_TAG=$(jq -r '.extra."branch-alias" | to_entries | .[0].value' composer.json)" >> $GITHUB_ENV
229+
230+ - name : Docker metadata
231+ id : meta
232+ uses : docker/metadata-action@v5
233+ with :
234+ images : |
235+ ${{ env.DOCKER_HUB_IMAGE_NAME }}
236+
237+ tags : |
238+ type=raw,value=${{ env.BRANCH_TAG }}
239+ type=raw,value=${{ env.BRANCH_ALIAS_TAG }}
240+ # Only the newest major EXT:solr branch can become the latest tag.
241+ # So if main branch becomes dev state for next TYPO3 LTS, the latest tag must be commented there.
242+ type=raw,value=latest,enable=${{ (startsWith(github.ref, 'refs/tags/')) && (env.IS_LATEST_VERSION == true) }}
243+ type=semver,pattern={{version}}
244+ type=semver,pattern={{major}}.{{minor}}
245+ labels : |
246+ org.opencontainers.image.title=${{github.event.repository.name}}
247+ org.opencontainers.image.description=Docker image for Apache Solr for TYPO3 CMS EXT:solr extension
248+ org.opencontainers.image.vendor=${{github.repository_owner}}
249+ org.opencontainers.image.licenses=GPL-3.0,APACHE
250+ org.opencontainers.image.version=${{github.ref_name}}
251+ org.opencontainers.image.created=${{ env.NOW }}
252+ org.opencontainers.image.source=${{github.server_url}}/${{github.repository}}
253+ org.opencontainers.image.revision=${{github.sha}}
254+ org.opencontainers.image.url=https://docs.typo3.org/p/apache-solr-for-typo3/solr/main/en-us/Appendix/DockerTweaks.html
255+ org.opencontainers.image.documentation=https://docs.typo3.org/p/apache-solr-for-typo3/solr/main/en-us/Index.html
256+
257+ -
258+ name : Set up QEMU
259+ uses : docker/setup-qemu-action@v2
260+
261+ -
262+ name : Set up Docker Buildx
263+ uses : docker/setup-buildx-action@v3
264+
265+ -
266+ name : Login to Docker Hub
267+ uses : docker/login-action@v2
268+ with :
269+ username : ${{ secrets.DOCKERHUB_USERNAME }}
270+ password : ${{ secrets.DOCKERHUB_TOKEN }}
271+
272+ -
273+ name : Build and push
274+ uses : docker/build-push-action@v6
275+ with :
276+ context : .
277+ file : ./Docker/SolrServer/Dockerfile
278+ platforms : ${{ env.DOCKER_PLATFORMS }}
279+ push : true
280+ tags : ${{ steps.meta.outputs.tags }}
281+ labels : ${{ steps.meta.outputs.labels }}
282+
205283 publish :
206284 name : Publish new version to TER
207285 needs : tests
0 commit comments