Skip to content

Commit

Permalink
Merge pull request #19 from vincejv/feat/switch-to-maven-git-versioni…
Browse files Browse the repository at this point in the history
…ng-extension

fix(versioning): use maven-git-versioning-extension instead of jgitver
  • Loading branch information
vincejv authored Oct 17, 2022
2 parents 588b47a + 8ee7922 commit c2ea5e4
Show file tree
Hide file tree
Showing 18 changed files with 122 additions and 98 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/release-dev.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
name: GCP Cloud Run CI/CD Dev

on:
push:
branches-ignore:
- main
pull_request:
types: [ opened, synchronize, reopened ]

env:
PROJECT_ID: fpi-sms-api
Expand Down Expand Up @@ -31,7 +30,7 @@ jobs:
id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
concurrent_skipping: same_content_newer
concurrent_skipping: outdated_runs
cancel_others: true

code_quality_checks:
Expand Down
46 changes: 28 additions & 18 deletions .github/workflows/release-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,31 @@ jobs:
id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
concurrent_skipping: same_content_newer
concurrent_skipping: outdated_runs
cancel_others: true

code_quality_checks:
name: Code quality checks
versioning:
name: Versioning
runs-on: ubuntu-latest
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
outputs:
new_tag: ${{ steps.tag_version.outputs.new_tag }}
changelog: ${{ steps.tag_version.outputs.changelog }}
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Bump version and push tag
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

code_quality_checks:
name: Code quality checks
runs-on: ubuntu-latest
needs: versioning
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -65,29 +82,22 @@ jobs:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=${{ env.SONAR_PROJECT_KEY }} -Dsonar.qualitygate.wait=true

versioning:
name: Versioning
github_release:
name: Perform Github release
runs-on: ubuntu-latest
needs: code_quality_checks
needs: [ versioning, code_quality_checks ]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Create a GitHub release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: Release ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
tag: ${{ needs.versioning.outputs.new_tag }}
name: Release ${{ needs.versioning.outputs.new_tag }}
body: ${{ needs.versioning.outputs.changelog }}

deploy_to_cloud:
name: Deploy to Cloud Run
runs-on: ubuntu-latest
needs: versioning
needs: code_quality_checks
permissions:
contents: read
packages: write
Expand Down Expand Up @@ -206,4 +216,4 @@ jobs:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
run: mvn -B deploy -Prelease-for-oss -Djgitver.config=./.mvn/jgitver.main.config.xml
run: mvn -B deploy -Prelease-for-oss
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@ nb-configuration.xml

# Prod Keys
**/*application-prod.yml

# Versioning plugin
.git-versioned-pom.xml
12 changes: 7 additions & 5 deletions .mvn/extensions.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<extensions xmlns="http://maven.apache.org/EXTENSIONS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.0.0 http://maven.apache.org/xsd/core-extensions-1.0.0.xsd">
<extension>
<groupId>fr.brouillard.oss</groupId>
<artifactId>jgitver-maven-plugin</artifactId>
<version>1.9.0</version>
</extension>

<extension>
<groupId>me.qoomon</groupId>
<artifactId>maven-git-versioning-extension</artifactId>
<version>9.3.1</version>
</extension>

</extensions>
10 changes: 0 additions & 10 deletions .mvn/jgitver.config.xml

This file was deleted.

10 changes: 0 additions & 10 deletions .mvn/jgitver.main.config.xml

This file was deleted.

20 changes: 20 additions & 0 deletions .mvn/maven-git-versioning-extension.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<configuration xmlns="https://github.com/qoomon/maven-git-versioning-extension"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://github.com/qoomon/maven-git-versioning-extension https://qoomon.github.io/maven-git-versioning-extension/configuration-9.1.0.xsd">
<refs considerTagsOnBranches="true">
<ref type="branch">
<pattern>main</pattern> <!-- expects that main branch is 1 commit = 1 tag -->
<describeTagPattern><![CDATA[v(?<version>.*)]]></describeTagPattern>
<version>${describe.tag.version}</version>
</ref>
<ref type="branch">
<pattern>.+</pattern>
<describeTagPattern><![CDATA[v(?<version>.*)]]></describeTagPattern>
<version>${describe.tag.version}-${commit.short}-SNAPSHOT</version>
</ref>
</refs>
<!-- optional fallback configuration in case of no matching ref configuration-->
<rev>
<version>${commit}-SNAPSHOT</version>
</rev>
</configuration>
3 changes: 3 additions & 0 deletions fpi-sms-api-core/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@ nb-configuration.xml

# Prod Keys
**/*application-prod.yml

# Versioning plugin
.git-versioned-pom.xml
12 changes: 7 additions & 5 deletions fpi-sms-api-core/.mvn/extensions.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<extensions xmlns="http://maven.apache.org/EXTENSIONS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.0.0 http://maven.apache.org/xsd/core-extensions-1.0.0.xsd">
<extension>
<groupId>fr.brouillard.oss</groupId>
<artifactId>jgitver-maven-plugin</artifactId>
<version>1.9.0</version>
</extension>

<extension>
<groupId>me.qoomon</groupId>
<artifactId>maven-git-versioning-extension</artifactId>
<version>9.3.1</version>
</extension>

</extensions>
10 changes: 0 additions & 10 deletions fpi-sms-api-core/.mvn/jgitver.config.xml

This file was deleted.

10 changes: 0 additions & 10 deletions fpi-sms-api-core/.mvn/jgitver.main.config.xml

This file was deleted.

20 changes: 20 additions & 0 deletions fpi-sms-api-core/.mvn/maven-git-versioning-extension.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<configuration xmlns="https://github.com/qoomon/maven-git-versioning-extension"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://github.com/qoomon/maven-git-versioning-extension https://qoomon.github.io/maven-git-versioning-extension/configuration-9.1.0.xsd">
<refs considerTagsOnBranches="true">
<ref type="branch">
<pattern>main</pattern> <!-- expects that main branch is 1 commit = 1 tag -->
<describeTagPattern><![CDATA[v(?<version>.*)]]></describeTagPattern>
<version>${describe.tag.version}</version>
</ref>
<ref type="branch">
<pattern>.+</pattern>
<describeTagPattern><![CDATA[v(?<version>.*)]]></describeTagPattern>
<version>${describe.tag.version}-${commit.short}-SNAPSHOT</version>
</ref>
</refs>
<!-- optional fallback configuration in case of no matching ref configuration-->
<rev>
<version>${commit}-SNAPSHOT</version>
</rev>
</configuration>
3 changes: 3 additions & 0 deletions fpi-sms-api-lib/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@ nb-configuration.xml

# Prod Keys
**/*application-prod.yml

# Versioning plugin
.git-versioned-pom.xml
12 changes: 7 additions & 5 deletions fpi-sms-api-lib/.mvn/extensions.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<extensions xmlns="http://maven.apache.org/EXTENSIONS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.0.0 http://maven.apache.org/xsd/core-extensions-1.0.0.xsd">
<extension>
<groupId>fr.brouillard.oss</groupId>
<artifactId>jgitver-maven-plugin</artifactId>
<version>1.9.0</version>
</extension>

<extension>
<groupId>me.qoomon</groupId>
<artifactId>maven-git-versioning-extension</artifactId>
<version>9.3.1</version>
</extension>

</extensions>
10 changes: 0 additions & 10 deletions fpi-sms-api-lib/.mvn/jgitver.config.xml

This file was deleted.

10 changes: 0 additions & 10 deletions fpi-sms-api-lib/.mvn/jgitver.main.config.xml

This file was deleted.

20 changes: 20 additions & 0 deletions fpi-sms-api-lib/.mvn/maven-git-versioning-extension.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<configuration xmlns="https://github.com/qoomon/maven-git-versioning-extension"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://github.com/qoomon/maven-git-versioning-extension https://qoomon.github.io/maven-git-versioning-extension/configuration-9.1.0.xsd">
<refs considerTagsOnBranches="true">
<ref type="branch">
<pattern>main</pattern> <!-- expects that main branch is 1 commit = 1 tag -->
<describeTagPattern><![CDATA[v(?<version>.*)]]></describeTagPattern>
<version>${describe.tag.version}</version>
</ref>
<ref type="branch">
<pattern>.+</pattern>
<describeTagPattern><![CDATA[v(?<version>.*)]]></describeTagPattern>
<version>${describe.tag.version}-${commit.short}-SNAPSHOT</version>
</ref>
</refs>
<!-- optional fallback configuration in case of no matching ref configuration-->
<rev>
<version>${commit}-SNAPSHOT</version>
</rev>
</configuration>
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<parent>
<groupId>com.abavilla</groupId>
<artifactId>fpi-framework-pom</artifactId>
<version>1.0.135</version>
<version>1.0.138</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down

0 comments on commit c2ea5e4

Please sign in to comment.