1
0
mirror of https://github.com/octoleo/plantuml-server.git synced 2024-12-22 08:48:54 +00:00

Refactor GitHub action

This commit is contained in:
Steve Hipwell 2021-09-17 17:42:25 +01:00 committed by arnaudroques
parent 61cbf1d3e5
commit a7789025eb

View File

@ -2,84 +2,98 @@ name: Main
on: on:
push: push:
tags: tags:
- '*' - "v*"
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
fetch-depth: 0 fetch-depth: 0
- uses: actions/setup-java@v2 - uses: actions/setup-java@v2
with: with:
distribution: 'adopt' distribution: "adopt"
java-version: '8' java-version: "8"
check-latest: true check-latest: true
cache: 'maven' cache: "maven"
- name: build with maven - name: build with maven
run: mvn --batch-mode --define java.net.useSystemProxies=true package run: mvn --batch-mode --define java.net.useSystemProxies=true package
- name: get tag name - name: get tag name
id: version id: version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/*/} run: echo ::set-output name=VERSION::${GITHUB_REF#refs/*/}
- name: create renamed build - name: create renamed build
run: cp target/plantuml.war target/plantuml-${{ steps.version.outputs.VERSION }}.war run: cp target/plantuml.war target/plantuml-${{ steps.version.outputs.VERSION }}.war
- name: upload binaries to release - name: upload binaries to release
uses: svenstaro/upload-release-action@v2 uses: svenstaro/upload-release-action@v2
with: with:
repo_token: ${{ secrets.GITHUB_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/plantuml-${{ steps.version.outputs.VERSION }}.war file: target/plantuml-${{ steps.version.outputs.VERSION }}.war
asset_name: plantuml-${{ steps.version.outputs.VERSION }}.war asset_name: plantuml-${{ steps.version.outputs.VERSION }}.war
tag: ${{ github.ref }} tag: ${{ github.ref }}
overwrite: true overwrite: true
- name: Set up QEMU - name: Docker tomcat meta
uses: docker/setup-qemu-action@v1 id: docker_meta_tomcat
uses: crazy-max/ghaction-docker-meta@v3
with:
flavor: |
latest=false
prefix=
suffix=
images: plantuml/plantuml-server
tags: |
type=semver,pattern=tomcat-{{raw}}
type=raw,value=tomcat
- name: Set up Docker Buildx - name: Docker jetty meta
uses: docker/setup-buildx-action@v1 id: docker_meta_jetty
uses: crazy-max/ghaction-docker-meta@v3
with:
flavor: |
latest=true
prefix=
suffix=
images: plantuml/plantuml-server
tags: |
type=semver,pattern={{raw}}
type=semver,pattern=jetty-{{raw}}
type=raw,value=jetty
- name: Login to DockerHub - name: Set up QEMU
uses: docker/login-action@v1 uses: docker/setup-qemu-action@v1
with:
- 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 }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: build docker tagged images - jetty - name: Build & push tomcat
uses: docker/build-push-action@v2 id: docker_build_tomcat
with: uses: docker/build-push-action@v2
push: true with:
tags: ${{ secrets.DOCKERHUB_USERNAME }}/plantuml-server:jetty-${{ steps.version.outputs.VERSION }} context: .
file: Dockerfile.jetty file: ./Dockerfile.tomcat
platforms: linux/amd64
push: true
tags: ${{ steps.docker_meta_tomcat.outputs.tags }}
labels: ${{ steps.docker_meta_tomcat.outputs.labels }}
- name: build docker latest images - jetty - name: Build & push jetty
uses: docker/build-push-action@v2 id: docker_build_jetty
with: uses: docker/build-push-action@v2
push: true with:
tags: ${{ secrets.DOCKERHUB_USERNAME }}/plantuml-server:jetty context: .
file: Dockerfile.jetty file: ./Dockerfile.jetty
platforms: linux/amd64
- name: build docker tagged images - tomcat push: true
uses: docker/build-push-action@v2 tags: ${{ steps.docker_meta_jetty.outputs.tags }}
with: labels: ${{ steps.docker_meta_jetty.outputs.labels }}
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/plantuml-server:tomcat-${{ steps.version.outputs.VERSION }}
file: Dockerfile.tomcat
- name: build docker latest images - tomcat
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/plantuml-server:tomcat
file: Dockerfile.tomcat
- name: build docker latest images - jetty as latest
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/plantuml-server:latest
file: Dockerfile.jetty