Skip to content

CI

CI #299

Workflow file for this run

name: CI
on:
# Triggers the workflow on push (branch and tag) or pull request events
create:
tags:
pull_request:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Java and Maven
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
- name: Maven Package
env:
GITHUB_TOKEN: ${{ github.token }} # GITHUB_TOKEN is the default env for the password
run: |
mvn clean test --batch-mode -s settings.xml
- name: Slack
uses: 8398a7/action-slack@v3
if: ${{ always() }}
with:
status: ${{ job.status }}
fields: repo,message,commit,author,ref,workflow,took,job
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Java and Maven
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
- name: Maven Package
env:
GITHUB_TOKEN: ${{ github.token }} # GITHUB_TOKEN is the default env for the password
run: |
mvn clean package --batch-mode -Dmaven.test.skip=true -s settings.xml
- uses: actions/upload-artifact@v2
if: ${{ success() }}
with:
name: loader.jar
path: target/loader.jar
- name: Slack
uses: 8398a7/action-slack@v3
if: ${{ always() }}
with:
status: ${{ job.status }}
fields: repo,message,commit,author,ref,workflow,took,job
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
deploy:
runs-on: ubuntu-latest
needs: build
if: ${{ success() && startsWith(github.ref, 'refs/tags/')}}
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: loader.jar
path: ${{ github.workspace }}/target
- 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: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/*\//}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: boomerangio/flow-loader:latest,boomerangio/flow-loader:${{ steps.get_version.outputs.VERSION }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
- name: Slack
uses: 8398a7/action-slack@v3
if: ${{ always() }}
with:
status: ${{ job.status }}
fields: repo,message,commit,author,ref,workflow,took,job
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}