Skip to content

Devopsnishu patch 1 #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 47 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
563b047
Update maven-publish.yml
devopsnishu Jun 21, 2023
485aebb
Update maven-publish.yml
devopsnishu Jun 21, 2023
ec6a728
Update maven-publish.yml
devopsnishu Jun 21, 2023
58caaee
Update pom.xml
devopsnishu Jun 21, 2023
e9cf68a
Update maven-publish.yml
devopsnishu Jun 22, 2023
8e23fe1
Update maven-publish.yml
devopsnishu Jun 22, 2023
d0cd67d
Create Dockerfile
devopsnishu Jun 22, 2023
5b05c37
Update maven-publish.yml
devopsnishu Jun 22, 2023
79f325e
Update maven-publish.yml
devopsnishu Jun 22, 2023
7b1f94d
Update maven-publish.yml
devopsnishu Jun 22, 2023
055d533
Update maven-publish.yml
devopsnishu Jun 22, 2023
565784c
Create sonar-project.properties
devopsnishu Jun 22, 2023
6027f64
Update maven-publish.yml
devopsnishu Jun 22, 2023
d196ea3
Update maven-publish.yml
devopsnishu Jun 22, 2023
a82de68
Update pom.xml
devopsnishu Jun 22, 2023
2af7bd4
Update maven-publish.yml
devopsnishu Jun 22, 2023
7c278f2
Create Sonar-Scanner.yml
devopsnishu Jun 22, 2023
26fdec4
Update Sonar-Scanner.yml
devopsnishu Jun 22, 2023
f28795b
Update pom.xml
devopsnishu Jun 22, 2023
0206824
Update maven-publish.yml
devopsnishu Jun 22, 2023
ab65f20
Update maven-publish.yml
devopsnishu Jun 22, 2023
f013496
Merge pull request #1 from devopsnishu/devopsnishu-patch-1
devopsnishu Jun 22, 2023
227e798
Update Sonar-Scanner.yml
devopsnishu Jun 22, 2023
ad79aba
Update maven-publish.yml
devopsnishu Jun 22, 2023
b309d9a
Update maven-publish.yml
devopsnishu Jun 22, 2023
f576ccb
Delete Sonar-Scanner.yml
devopsnishu Jun 22, 2023
e2fb129
Update maven-publish.yml
devopsnishu Jun 22, 2023
ac7542b
Update maven-publish.yml
devopsnishu Jun 22, 2023
da21678
Update maven-publish.yml
devopsnishu Jun 22, 2023
1df0660
Create pom.xml
devopsnishu Jun 22, 2023
8432dac
Update pom.xml
devopsnishu Jun 22, 2023
37cded9
Update pom.xml
devopsnishu Jun 22, 2023
e46a642
Update maven-publish.yml
devopsnishu Jun 23, 2023
e5b33d9
Update maven-publish.yml
devopsnishu Jun 23, 2023
a298d92
Update maven-publish.yml
devopsnishu Jun 23, 2023
d8bb857
Update maven-publish.yml
devopsnishu Jun 23, 2023
5dcb796
Update maven-publish.yml
devopsnishu Jun 23, 2023
a810cbf
Update maven-publish.yml
devopsnishu Jun 23, 2023
3256058
Update maven-publish.yml
devopsnishu Jun 23, 2023
e554dd3
Update maven-publish.yml
devopsnishu Jun 23, 2023
d22aa55
Update maven-publish.yml
devopsnishu Jun 25, 2023
54e42db
Update maven-publish.yml
devopsnishu Jun 25, 2023
3487154
Update maven-publish.yml
devopsnishu Jun 25, 2023
21f80e8
Update maven-publish.yml
devopsnishu Jun 25, 2023
c080b54
Update maven-publish.yml
devopsnishu Jun 25, 2023
7b77b53
Update maven-publish.yml
devopsnishu Jun 26, 2023
d7edcbf
Update maven-publish.yml
devopsnishu Jun 26, 2023
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
55 changes: 47 additions & 8 deletions .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,66 @@ name: Maven Package
on:
push:
branches: [master]
release:
types: [created]

jobs:
build:

runs-on: ubuntu-latest

steps:

- uses: actions/checkout@v2
- name: Set up JDK 1.8
with:
fetch-depth: 0
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11
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

- name: Publish to GitHub Packages Apache Maven
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
- name: Analyze with SonarCloud
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=devopsnishu_github-example-package
env:
GITHUB_TOKEN: ${{ github.token }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: API with curl
run: |
curl -u ${{ secrets.SONAR_TOKEN }} https://sonarcloud.io/api/project_badges/measure?project=devopsnishu_github-example-package&metric=coverage

- name: Test with Maven
run: mvn -B test --file pom.xml
- name: Archive production artifacts
uses: actions/upload-artifact@v2
with:
name: Java-jar
path: |
src/target/*.jar
src/target/*.zip

-
name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
-
name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ secrets.DOCKERHUB_USERNAME }}/java

-
name: Build and push
uses: docker/build-push-action@v2
with:
context: .
dockerfile: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}


2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FROM openjdk:8
EXPOSE 8080
25 changes: 14 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,31 @@
<artifactId>github-example-package</artifactId>
<version>1.2-SNAPSHOT</version>
<packaging>jar</packaging>

<properties>
<sonar.organization>devopsnishu</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
</properties>
<distributionManagement>
<repository>
<id>github</id>
<name>GitHub ManjunathPrabhakar Apache Maven Packages</name>
<url>https://maven.pkg.github.com/ManjunathPrabhakar/github-example-package</url>
<name>GitHub devopsnishu Apache Maven Packages</name>
<url>https://maven.pkg.github.com/devopsnishu/github-example-package</url>
</repository>
</distributionManagement>
<developers>
<developer>
<name>Manjunath Prabhakar</name>
<email>manjunath189@gmail.com</email>
<organization>com.github.manjunathprabhakar</organization>
<organizationUrl>https://github.com/ManjunathPrabhakar/github-example-package</organizationUrl>
<name>devopsnishur</name>
<email>nishuranirai1997@gmail.com</email>
<organization>com.github.devopsnishur</organization>
<organizationUrl>https://github.com/devopsnishu/github-example-package</organizationUrl>
</developer>
</developers>

<scm>
<connection>scm:git:git://github.com/ManjunathPrabhakar/github-example-package.git</connection>
<developerConnection>scm:git:https://github.com/ManjunathPrabhakar/github-example-package.git
<connection>scm:git:git://github.com/devopsnishu/github-example-package.git</connection>
<developerConnection>scm:git:https://github.com/devopsnishu/github-example-package.git
</developerConnection>
<url>https://github.com/ManjunathPrabhakar/github-example-package</url>
<url>https://github.com/devopsnishu/github-example-package</url>
<tag>github-example-package</tag>
</scm>

Expand Down Expand Up @@ -70,4 +73,4 @@
</plugins>
</build>

</project>
</project>
9 changes: 9 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
sonar.projectKey=devopsnishu_github-example-package
sonar.organization=devopsnishu

# This is the name and version displayed in the SonarCloud UI.
#sonar.projectName=github-example-package
#sonar.projectVersion=1.0

sonar.sources=.

80 changes: 80 additions & 0 deletions src/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.example</groupId>
artifactId>parent</artifactId>
<version>${revision}</version>
</parent>

<artifactId>src</artifactId>
<packaging>jar</packaging>
<name>Java-jar</name>
<properties>
<sonar.organization>devopsnishu</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
</properties>
<distributionManagement>
<repository>
<id>github</id>
<name>GitHub devopsnishu Apache Maven Packages</name>
<url>https://maven.pkg.github.com/devopsnishu/github-example-package</url>
</repository>
</distributionManagement>
<developers>
<developer>
<name>devopsnishur</name>
<email>nishuranirai1997@gmail.com</email>
<organization>com.github.devopsnishur</organization>
<organizationUrl>https://github.com/devopsnishu/github-example-package</organizationUrl>
</developer>
</developers>

<scm>
<connection>scm:git:git://github.com/devopsnishu/github-example-package.git</connection>
<developerConnection>scm:git:https://github.com/devopsnishu/github-example-package.git
</developerConnection>
<url>https://github.com/devopsnishu/github-example-package</url>
<tag>github-example-package</tag>
</scm>

<build>
<pluginManagement>
<plugins>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<!-- see http://jira.codehaus.org/browse/MNG-5346 -->
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.9.1</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>3.0.0-M1</version>
</plugin>
</plugins>
</build>

</project>