Merge pull request #313 from thomasegense/master #102
This file contains 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: Java CI Maven Build | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
- name: Build with Maven | |
# Usually the build would run 'verify' but this runs the long-winded integration tests, so we run 'test' here only: | |
run: | | |
export JAVA_OPTS="-Xmx2048m" | |
export MAVEN_CLI_OPTS="--no-transfer-progress" | |
mvn --batch-mode test | |
push_to_docker_hub: | |
needs: build | |
name: Push Docker image to Docker Hub | |
# This uses the default metadata-action configuration, see https://github.com/docker/metadata-action | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v2 | |
- name: Set up Docker metadata | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
images: ${{ github.repository }} | |
- name: Log in to Docker Hub | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
- name: Build and push to Docker Hub | |
uses: docker/build-push-action@v2 | |
with: | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
push_solr_to_docker_hub: | |
needs: build | |
name: Push Solr Docker image to Docker Hub | |
# This uses the default metadata-action configuration, see https://github.com/docker/metadata-action | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v2 | |
- name: Set up Docker metadata | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
# Use different container name: | |
images: ukwa/webarchive-discovery-solr | |
- name: Log in to Docker Hub | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
- name: Build and push to Docker Hub | |
uses: docker/build-push-action@v2 | |
with: | |
# Use different build context: | |
context: ./warc-indexer/src/main/solr | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
push_solr9_to_docker_hub: | |
needs: build | |
name: Push Solr 9 Docker image to Docker Hub | |
# This uses the default metadata-action configuration, see https://github.com/docker/metadata-action | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v2 | |
- name: Set up Docker metadata | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
# Use different container name: | |
images: ukwa/webarchive-discovery-solr | |
flavor: | | |
latest=auto | |
prefix= | |
suffix=-solr9 | |
- name: Log in to Docker Hub | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
- name: Build and push to Docker Hub | |
uses: docker/build-push-action@v2 | |
with: | |
# Use different build context: | |
context: ./warc-indexer/src/main/solr | |
file: ./warc-indexer/src/main/solr/Dockerfile9 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |