Skip to content

Commit

Permalink
Merge pull request #22 from jaguililla/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
jaguililla authored Aug 29, 2024
2 parents 7797f7c + 4e90916 commit fc629e1
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 97 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
16 changes: 9 additions & 7 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ build:

release:
stage: release
image: ubuntu:24.04
image: maven:3
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
before_script:
Expand All @@ -48,11 +48,13 @@ release:
- export REGISTRY_PASSWORD="${CI_REGISTRY_PASSWORD}"
- export CLIENT_PATH='target/generated-sources/openapi'
- export CONTROLLERS_PATH='com/github/jaguililla/appointments/http/controllers'
- export REPOSITORY='https://gitlab.example.com/api/v4/projects/jaguililla/hexagonal_spring/packages/maven'
- export ALT_REPOSITORY="altDeploymentRepository=github::default::${REPOSITORY}"
- ./mvnw -D image.registry=${CI_REGISTRY}/jaguililla/hexagonal_spring -B -P publish
- 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 -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: tag
description: Description TODO
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>
20 changes: 20 additions & 0 deletions ci_settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<settings
xmlns="http://maven.apache.org/SETTINGS/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">

<servers>
<server>
<id>gitlab</id>
<configuration>
<httpHeaders>
<property>
<name>Job-Token</name>
<value>${CI_JOB_TOKEN}</value>
</property>
</httpHeaders>
</configuration>
</server>
</servers>
</settings>
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 fc629e1

Please sign in to comment.