Skip to content

Commit

Permalink
Merge pull request #159 from teixeira-fernando/getting-rid-of-depende…
Browse files Browse the repository at this point in the history
…ncies-between-modules

trying out automated config to release packages of the application
  • Loading branch information
teixeira-fernando authored Oct 15, 2023
2 parents 8dae1ee + 664bcb3 commit 902481f
Show file tree
Hide file tree
Showing 7 changed files with 100 additions and 6 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/maven-packages-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# 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:
release:
types: [created]

jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'adopt'
- name: maven install
run: mvn clean install
- name: Publish to GitHub Packages Apache Maven
run: GITHUB_TOKEN=${{ github.token }} make publish_all_packages
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@ run-pact-provider-tests:

record_deployment:
@"${PACT_CLI}" pact-broker record_deployment --pacticipant ${PACTICIPANT} --version ${GIT_COMMIT} --environment production --broker-base-url=${PACT_BROKER_URL} --broker-token=${PACT_BROKER_TOKEN}

publish_all_packages:
mvn -f inventory/ deploy -s settings.xml -Dserver.github.password=${GITHUB_TOKEN}
mvn -f shop/ deploy -s settings.xml -Dserver.github.password=${GITHUB_TOKEN}
mvn -f shipment/ deploy -s settings.xml -Dserver.github.password=${GITHUB_TOKEN}
mvn -f base-domain/ deploy -s settings.xml -Dserver.github.password=${GITHUB_TOKEN}
7 changes: 5 additions & 2 deletions base-domain/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
</parent>

<name>base-domain</name>
<description>Module with shared domain classes from Ecommerce project</description>
<artifactId>base-domain</artifactId>
<version>1.0.0</version>
<version>${revision}</version>
<packaging>jar</packaging>

<dependencies>
<dependency>
Expand Down Expand Up @@ -65,7 +67,7 @@
<distributionManagement>
<repository>
<id>github</id>
<name>my-maven-packages</name>
<name>teixeira-fernando</name>
<url>https://maven.pkg.github.com/teixeira-fernando/ecommerceapp</url>
</repository>
</distributionManagement>
Expand All @@ -76,6 +78,7 @@
<java.version>11</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.plugin.validation>VERBOSE</maven.plugin.validation>
<revision>1.0.0-SNAPSHOT</revision>
</properties>

</project>
10 changes: 8 additions & 2 deletions inventory/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
<dependency>
<groupId>com.ecommerceapp</groupId>
<artifactId>base-domain</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<artifactId>spring-boot-starter-actuator</artifactId>
Expand Down Expand Up @@ -226,7 +226,13 @@
</dependencies>



<distributionManagement>
<repository>
<id>github</id>
<name>teixeira-fernando</name>
<url>https://maven.pkg.github.com/teixeira-fernando/ecommerceapp</url>
</repository>
</distributionManagement>

<description>Ecommerce Inventory</description>
<groupId>com.ecommerceapp</groupId>
Expand Down
36 changes: 36 additions & 0 deletions settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">

<activeProfiles>
<activeProfile>github</activeProfile>
</activeProfiles>

<profiles>
<profile>
<id>github</id>
<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
</repository>
<repository>
<id>github</id>
<url>https://maven.pkg.github.com/teixeira-fernando/ecommerceapp</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>

<servers>
<server>
<id>github</id>
<username>teixeira-fernando</username>
<password>${server.github.password}</password>
</server>
</servers>
</settings>
10 changes: 9 additions & 1 deletion shipment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@
<packaging>jar</packaging>
<version>0.0.1-SNAPSHOT</version>

<distributionManagement>
<repository>
<id>github</id>
<name>teixeira-fernando</name>
<url>https://maven.pkg.github.com/teixeira-fernando/ecommerceapp</url>
</repository>
</distributionManagement>

<properties>
<java.version>11</java.version>
</properties>
Expand Down Expand Up @@ -170,7 +178,7 @@
<dependency>
<groupId>com.ecommerceapp</groupId>
<artifactId>base-domain</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<artifactId>spring-boot-starter-actuator</artifactId>
Expand Down
10 changes: 9 additions & 1 deletion shop/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
<dependency>
<groupId>com.ecommerceapp</groupId>
<artifactId>base-domain</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<artifactId>spring-boot-starter-actuator</artifactId>
Expand Down Expand Up @@ -304,6 +304,14 @@
<name>shop</name>
<packaging>jar</packaging>

<distributionManagement>
<repository>
<id>github</id>
<name>teixeira-fernando</name>
<url>https://maven.pkg.github.com/teixeira-fernando/ecommerceapp</url>
</repository>
</distributionManagement>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
Expand Down

0 comments on commit 902481f

Please sign in to comment.