Skip to content

Commit

Permalink
Fix :GitLab :release :CI
Browse files Browse the repository at this point in the history
  • Loading branch information
jaguililla committed Aug 29, 2024
1 parent 4ae58e7 commit 4e90916
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 93 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,12 @@ jobs:
sdk env install
export REGISTRY_USERNAME="${GITHUB_ACTOR}"
export REGISTRY_PASSWORD="${GITHUB_TOKEN}"
export GIT_USERNAME="${GITHUB_ACTOR}"
export POM_VERSION="$(mvn help:evaluate -D expression=project.version -q -D forceStdout)"
./mvnw -D image.registry=ghcr.io/jaguililla/hexagonal_spring -B -P publish,release
git config user.name "${GIT_USERNAME}"
./mvnw -D image.registry=ghcr.io/jaguililla/hexagonal_spring -D spring-boot.build-image.publish=true -B deploy
git tag -m "Release ${POM_VERSION}" "${POM_VERSION}"
git push --tags
- name: Publish Client
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
6 changes: 3 additions & 3 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ release:
- export REPOSITORY="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/maven"
- export ALT_REPOSITORY="altDeploymentRepository=gitlab::default::${REPOSITORY}"
- export IMG_REGISTRY="${CI_REGISTRY}/jaguililla/hexagonal_spring"
- export POM_VERSION="$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)"
- ./mvnw -s ci_settings.xml -D ${ALT_REPOSITORY} -D image.registry=${IMG_REGISTRY} -B -P publish
- export POM_VERSION="$(mvn help:evaluate -D expression=project.version -q -D forceStdout)"
- ./mvnw -s ci_settings.xml -D ${ALT_REPOSITORY} -D image.registry=${IMG_REGISTRY} -D spring-boot.build-image.publish=true -B deploy
- rm -rf "${CLIENT_PATH}/src/main/java/${CONTROLLERS_PATH}"
- mvn -f "${CLIENT_PATH}/pom.xml" -B -D ${ALT_REPOSITORY} clean deploy
- mvn -s ci_settings.xml -f "${CLIENT_PATH}/pom.xml" -B -D ${ALT_REPOSITORY} clean deploy
release:
tag_name: ${POM_VERSION}
description: Release ${POM_VERSION}
93 changes: 6 additions & 87 deletions .mvn/parent.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<docker>
<publishRegistry>
<username>${env.REGISTRY_USERNAME}</username>
<password>${env.REGISTRY_PASSWORD}</password>
</publishRegistry>
</docker>
<image>
<name>${image.registry}/${image.name}:${project.version}</name>
<tags>
Expand Down Expand Up @@ -247,92 +253,5 @@
</dependency>
</dependencies>
</profile>

<profile>
<id>publish</id>

<build>
<defaultGoal>${release.goal}</defaultGoal>

<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<docker>
<publishRegistry>
<username>${env.REGISTRY_USERNAME}</username>
<password>${env.REGISTRY_PASSWORD}</password>
</publishRegistry>
</docker>
<publish>true</publish>
</configuration>
</plugin>
</plugins>
</build>
</profile>

<profile>
<id>release</id>

<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<executable>git</executable>
</configuration>

<executions>
<execution>
<id>config</id>
<phase>verify</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<arguments>
<argument>config</argument>
<argument>--global</argument>
<argument>user.name</argument>
<argument>${env.GIT_USERNAME}</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>tag</id>
<phase>verify</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<arguments>
<argument>tag</argument>
<argument>-m</argument>
<argument>Release ${project.version}</argument>
<argument>${project.version}</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>push</id>
<phase>verify</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<arguments>
<argument>push</argument>
<argument>--tags</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</parent>

<artifactId>appointments</artifactId>
<version>0.3.2</version>
<version>0.3.3</version>

<name>Appointments</name>
<description>Application to create appointments (REST API)</description>
Expand Down

0 comments on commit 4e90916

Please sign in to comment.