Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Java CI with Maven

on:
push:
branches: [ dev ]
pull_request:
branches: [ dev ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
cache: maven

- name: Code check
uses: dbelyaev/action-checkstyle@v0.5.1
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
level: warning

- name: Build with Maven
run: |
mvn -B package --file pom.xml
mkdir artifacts && cp target/*.jar artifacts
cd artifacts && ls

- name: Save artifact
uses: actions/upload-artifact@v2
with:
name: github-actions-artifact
path: artifacts

- name: Upload artificat
uses: actions/upload-artifact@v2
with:
name: sample.jar
path: target/*.jar

Publish:
needs: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: '11'

- name: Update version
run: mvn -B versions:set -DnewVersion=v${{github.run_number}} -DgenerateBackupPoms=false
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Download artifact
uses: actions/download-artifact@v2

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: shydrate/demo-app:v${{github.run_number}}
53 changes: 50 additions & 3 deletions .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
name: Java CI with Maven

on:
push:
branches: [ master ]
# push:
# branches: [ dev, qa, master ]
pull_request:
branches: [ master ]
branches: [ master, qa ]

jobs:
build:
Expand All @@ -22,13 +22,60 @@ jobs:
java-version: '11'
distribution: 'adopt'
cache: maven

- name: Code check
uses: dbelyaev/action-checkstyle@v0.5.1
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
level: warning

- name: Build with Maven
run: |
mvn -B package --file pom.xml
mkdir artifacts && cp target/*.jar artifacts
cd artifacts && ls

- name: Save artifact
uses: actions/upload-artifact@v2
with:
name: github-actions-artifact
path: artifacts

- name: Upload artificat
uses: actions/upload-artifact@v2
with:
name: sample.jar
path: target/*.jar

Publish:
needs: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: '11'

- name: Update version
run: mvn -B versions:set -DnewVersion=v${{github.run_number}} -DgenerateBackupPoms=false
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Download artifact
uses: actions/download-artifact@v2

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: shydrate/demo-app:v${{github.run_number}}
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM tomcat
#USER root
ADD sample.jar sample.jar
EXPOSE 80
EXPOSE 8080

ENTRYPOINT [ "java", "-DskipTests", "-jar", "sample.jar", "-Xmx256m"]