86 lines
2.1 KiB
YAML
86 lines
2.1 KiB
YAML
name: latest
|
|
|
|
on:
|
|
push:
|
|
branches: master
|
|
|
|
jobs:
|
|
# test:
|
|
# runs-on: ubuntu-latest
|
|
# steps:
|
|
# - name: Checkout repository
|
|
# uses: actions/checkout@v2
|
|
# - name: Set up JDK11
|
|
# uses: actions/setup-java@v1
|
|
# with:
|
|
# java-version: 11
|
|
# - name: Run tests
|
|
# run: mvn clean test
|
|
# env:
|
|
# SERVER_PWD: somePW
|
|
# services:
|
|
# seb-server-mariadb:
|
|
# image: mariadb:10
|
|
# env:
|
|
# MYSQL_ROOT_PASSWORD: somePW
|
|
# MYSQL_ALLOW_EMPTY_PASSWORD: yes
|
|
|
|
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v2
|
|
- name: Set up JDK11
|
|
uses: actions/setup-java@v1
|
|
with:
|
|
java-version: 11
|
|
- name: Cache Maven packages
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: ~/.m2
|
|
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
|
|
restore-keys: ${{ runner.os }}-m2
|
|
- name: Build with maven
|
|
run: mvn clean package -DskipTests -Dbuild-version="demo"
|
|
- uses: actions/upload-artifact@v2
|
|
with:
|
|
name: Package
|
|
path: target/seb-server-demo.jar
|
|
|
|
|
|
docker_push:
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
steps:
|
|
-
|
|
name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v1
|
|
-
|
|
name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v1
|
|
-
|
|
name: Login to DockerHub
|
|
uses: docker/login-action@v1
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v2
|
|
-
|
|
name: Download a single artifact
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: Package
|
|
-
|
|
name: Build and push
|
|
id: docker_build
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
context: .
|
|
file: ./docker/demo/Dockerfile
|
|
push: true
|
|
tags: bengig/seb-server:demo
|
|
-
|
|
name: Image digest
|
|
run: echo ${{ steps.docker_build.outputs.digest }}
|