Skip to content

Merge pull request #214 from julianu/main #33

Merge pull request #214 from julianu/main

Merge pull request #214 from julianu/main #33

# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Maven and Docker build
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
release:
types: [ "published" ]
jobs:
maven_build:
runs-on: ubuntu-latest
permissions:
contents: write # needed by softprops/action-gh-release
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
cache: maven
- name: Build with Maven
run: mvn -B package --settings ./.mvn/unblock-mirrors.xml --update-snapshots verify --file pom.xml
# package as artifact
- run: mkdir staging && cp target/*.jar staging && cp target/*.zip staging
- uses: actions/upload-artifact@v4
with:
name: pia-package
path: staging
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
name: codecov-umbrella
verbose: true
- name: Release
if: ${{ github.event_name == 'release' }}
uses: softprops/action-gh-release@v2
with:
files: |
staging/*.zip
build_and_push_docker:
needs: maven_build
runs-on: ubuntu-latest
if: ${{ github.event_name == 'release' }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: quay.io/medbioinf/pia
labels: |
org.opencontainers.image.title=PIA
org.opencontainers.image.description=PIA - Protein Inference Algorithms
- name: Build Image
id: build-image
uses: redhat-actions/buildah-build@v2
with:
image: pia
tags: quay.io/medbioinf/pia:latest ${{ steps.meta.outputs.tags }}
containerfiles: |
./Dockerfile
- name: Push to quay.io
id: push-to-quay
uses: redhat-actions/push-to-registry@v2
with:
tags: ${{ steps.build-image.outputs.tags }}
username: ${{ secrets.QUAY_ROBOT_ID }}
password: ${{ secrets.QUAY_ROBOT_PW }}