remove sonatype.org from pom #326
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: Java Maven Build, Test, and Publish | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
# - feature* | |
- develop | |
- bugfix-* | |
- '*-auto-img' | |
tags: [ 'v*.*.*' ] | |
env: | |
# Use docker.io for Docker Hub if empty | |
REGISTRY: ghcr.io | |
# github.repository as <account>/<repo> | |
#IMAGE_NAME: ${{ github.repository }} | |
IMAGE_NAME: ${{ github.repository_owner }}/dataone-index-worker | |
SOLR_VERSION: 9.8.1 | |
jobs: | |
maven-build: | |
name: Maven Build and Test | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.get_version.outputs.version }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: 'maven' | |
- name: Extract Maven project version | |
run: | | |
echo "version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT | |
id: get_version | |
- name: Start Solr | |
run: | | |
wget -q https://downloads.apache.org/solr/solr/${{ env.SOLR_VERSION }}/solr-${{ env.SOLR_VERSION }}.tgz | |
tar xzf solr-${{ env.SOLR_VERSION }}.tgz | |
solr-${{ env.SOLR_VERSION }}/bin/solr start -p 8983 | |
- name: Setup data directory | |
run: sudo mkdir -p /var/metacat/data && sudo chmod -R 777 /var/metacat | |
- name: Build and Test | |
run: mvn --batch-mode --update-snapshots test | |
- name: Package | |
run: mvn --batch-mode --update-snapshots -DskipTests=true package | |
- uses: actions/cache@v3 | |
with: | |
path: . | |
key: builddir-${{ github.run_id }} | |
docker-publish: | |
name: Docker Build and Publish | |
if: github.ref_name == 'develop' || github.ref_name == 'v*.*.*' | |
needs: maven-build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/cache@v3 | |
with: | |
path: . | |
key: builddir-${{ github.run_id }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
# Login against a Docker registry except on PR | |
# https://github.com/docker/login-action | |
- name: Log into registry ${{ env.REGISTRY }} | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# Extract metadata (tags, labels) for Docker | |
# https://github.com/docker/metadata-action | |
- name: Extract Docker metadata | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
# Build and push Docker image with Buildx (don't push on PR) | |
# https://github.com/docker/build-push-action | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: docker/Dockerfile | |
build-args: TAG=${{needs.maven-build.outputs.version}} | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |