Skip to content

Update app.yml

Update app.yml #78

Workflow file for this run

# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path
name: Maven Package
on:
push:
branches:
- main
- 'releases/**'
env:
APP_NAME: zihjiang/filling
DOCKERHUB_REPO: zihjiang/filling
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
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: Build with Maven
run: mvn -B package --file pom.xml -DskipTests
- 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: Generate App Version
run: echo APP_VERSION=`echo $GITHUB_REF_NAME|sed -e "s/releases\///g"` >> $GITHUB_ENV
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
build-args: |
APP_VERSION=${{ env.APP_VERSION }}
APP_VERSION=${{ env.APP_NAME }}
push: true
tags: |
${{ env.APP_NAME }}:latest
${{ env.APP_NAME }}:${{ env.APP_VERSION }}