Skip to content

Merge pull request #234 from OHSUCMP/feature/issue232 #232

Merge pull request #234 from OHSUCMP/feature/issue232

Merge pull request #234 from OHSUCMP/feature/issue232 #232

Workflow file for this run

---
name: build
on:
push:
branches:
- master
tags:
- "v*.*.*"
workflow_dispatch:
jobs:
build-java-source:
name: build jar file
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up Java build environmant
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '11'
cache: 'maven'
- name: Build with Maven
run: mvn package -DskipTests
- name: Upload jar file
uses: actions/upload-artifact@v3
with:
name: coach.jar
path: target/coach.jar
build-image:
name: build Docker image
needs: build-java-source
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{github.repository}}
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log into container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Image metadata
id: image_metadata
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=raw,value=latest,enable={{is_default_branch}}
- name: Download jar file
uses: actions/download-artifact@v3
with:
name: coach.jar
path: target
- name: Build Docker image
uses: docker/build-push-action@v3
with:
push: true
context: .
tags: ${{ steps.image_metadata.outputs.tags }}
labels: ${{ steps.image_metadata.outputs.labels }}