update to mei 5 refs #71 #121
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
# This workflow will build a Java project with Maven | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven | |
name: maven and docker | |
on: | |
push: | |
branches: [ main, dev ] | |
tags: [ v* ] | |
pull_request: | |
branches: [ main, dev ] | |
jobs: | |
build: | |
name: compile maven package | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'adopt' | |
- name: maven-settings | |
uses: s4u/[email protected] | |
with: | |
servers: '[{"id": "edirom", "username": "${github.actor}", "password": "${GITHUB_TOKEN}"},{"id": "teic", "username": "${github.actor}", "password": "${GITHUB_TOKEN}"}]' | |
- name: Build with Maven | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: mvn clean package --file pom.xml | |
- name: Upload Maven build artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: artifact | |
path: /home/runner/work/MEIGarage/MEIGarage/target/meigarage.war | |
docker: | |
name: build the Docker image | |
needs: build | |
runs-on: ubuntu-latest | |
#don't run docker build on pull request at all | |
if: ${{ github.event_name != 'pull_request' }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Download artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: artifact | |
path: artifact/ | |
# use the current user to log into the | |
# GitHub container registry | |
- name: Log in to GitHub Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# Login against DockerHub registry | |
- name: Log in to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: vifebot | |
password: ${{ secrets.VIFEBOT_DOCKERHUB_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: | | |
ghcr.io/edirom/meigarage | |
edirom/meigarage | |
flavor: | | |
latest=${{ github.ref == 'refs/heads/main' }} | |
# 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: . | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: | | |
BUILDTYPE=github | |
# Use current README for DockerHub description | |
- name: Update repo description | |
uses: peter-evans/dockerhub-description@v3 | |
with: | |
username: vifebot | |
password: ${{ secrets.VIFEBOT_DOCKERHUB_TOKEN }} | |
repository: edirom/meigarage | |
short-description: ${{ github.event.repository.description }} |