Skip to content

Commit

Permalink
[pojotesting-example] #1 : Create ci file - deploy to jfrog
Browse files Browse the repository at this point in the history
  • Loading branch information
ollily committed Nov 26, 2022
1 parent eebc095 commit 6c1c8b6
Show file tree
Hide file tree
Showing 3 changed files with 148 additions and 74 deletions.
30 changes: 5 additions & 25 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
paths-ignore:
# - '.github/**'
- '.run/**'
# - '.m2/**'
- '.m2/**'
- '.repo/**'


Expand All @@ -22,6 +22,9 @@ env:
GITHUB_UPLOAD_DIR: ${{ github.workspace }}/staging
GITHUB_UPLOAD_NAME: ${{ github.event.repository.name }}.zip
GITHUB_BRANCH_NAME: ${{ github.ref_name }}
GITHUB_DISTRIB_URL: https://maven.pkg.github.com
GITHUB_DISTRIB_REPO_SS: The-oGlow/Awesome-Snap-Shots
GITHUB_DISTRIB_REPO_REL: The-oGlow/Central-Awesome-Index
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PCK_READ_TOKEN: ${{ secrets.PCK_READ_TOKEN }}
PCK_WRITE_TOKEN: ${{ secrets.PCK_WRITE_TOKEN }}
Expand All @@ -35,11 +38,6 @@ env:
MVN_BUILD_OPTS: -fae -Dmaven.test.failure.ignore=true
MVN_CLI_OPTS: -ff
MVN_DEPLOY_OPTS: -Pdeploy-jfrog -DfastBuild -DretryFailedDeploymentCount=10
MVN_DISTRIB_URL: https://maven.pkg.github.com
MVN_DISTRIB_REPO_SS: The-oGlow/Awesome-Snap-Shots
MVN_DISTRIB_REPO_REL: The-oGlow/Central-Awesome-Index
CHK_FILE: com/glowa-net/maven/parent/global-appl-pom/3-SNAPSHOT/maven-metadata.xml
CHK_FUNC: echo SUCCESS || echo FAIL

# Maven Sign Configuration
MVN_SIGN_OPTS: -P!generate-gpgkey -P!sign-jar
Expand Down Expand Up @@ -73,13 +71,6 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
# - name: validate deploy repos
# run: |
# curl -fH "Authorization: Bearer ${{ secrets.PCK_READ_TOKEN }}" "${{ env.MVN_DISTRIB_URL }}/${{ env.MVN_DISTRIB_REPO_SS }}/${{ env.CHK_FILE }}" && ${{ env.CHK_FUNC }}
# curl -fH "Authorization: Bearer ${{ secrets.PCK_WRITE_TOKEN }}" "${{ env.MVN_DISTRIB_URL }}/${{ env.MVN_DISTRIB_REPO_SS }}/${{ env.CHK_FILE }}" && ${{ env.CHK_FUNC }}
# curl -f -u "${{ env.GITHUB_ACTOR }}:${{ secrets.PCK_WRITE_TOKEN }}" "${{ env.MVN_DISTRIB_URL }}/${{ env.MVN_DISTRIB_REPO_SS }}/${{ env.CHK_FILE }}" && ${{ env.CHK_FUNC }}
# curl -f -u "${{ env.GITHUB_ACTOR }}:${{ secrets.GITHUB_TOKEN }}" "${{ env.MVN_DISTRIB_URL }}/${{ env.MVN_DISTRIB_REPO_SS }}/${{ env.CHK_FILE }}" && ${{ env.CHK_FUNC }}

- name: checkout
uses: actions/checkout@v3.0.2
with:
Expand All @@ -104,21 +95,11 @@ jobs:
key: ${{ matrix.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ matrix.os }}-m2

#- name: maven settings
# uses: s4u/maven-settings-action@v2.6.0
# with:
# servers: '[{"id": "coding.github.ss", "username": "${env.GITHUB_ACTOR}", "password": "${env.GITHUB_TOKEN}"}, {"id": "coding.github.ss.deploy", "username": "${env.GITHUB_ACTOR}", "password": "${env.GITHUB_TOKEN}"}]'
# with:
# servers: '[{ "id": "coding.github.ss", "username": "${{ github.github_actor }}", "configuration": { "httpHeaders": { "property": { "name": "Authorization", "value": "Bearer ${{ secrets.PCK_READ_TOKEN }}" }}}}, { "id": "coding.github.ss.deploy", "username": "${{ github.github_actor }}", "configuration": { "httpHeaders": { "property": { "name": "Authorization", "value": "Bearer ${{ secrets.PCK_WRITE_TOKEN }}" }}}}]'

#- name: show settings
# run: cat ${{ env.MVN_HOME_DIR }}/settings.xml

- name: show settings
run: cat ${{ github.workspace}}/.m2/settings.xml

- name: maven build
run: mvn ${{ env.MVN_SETS_OPTS }} ${{ env.MVN_SIGN_OPTS }} ${{ env.MVN_TEST_OPTS_Y }} ${{ env.MVN_BUILD_OPTS }} help:active-profiles clean install
run: mvn ${{ env.MVN_SETS_OPTS }} ${{ env.MVN_SIGN_OPTS }} ${{ env.MVN_TEST_OPTS_N }} ${{ env.MVN_BUILD_OPTS }} help:active-profiles clean install

- name: show build
run: |
Expand Down Expand Up @@ -146,4 +127,3 @@ jobs:

- name: deploy artifact
run: mvn ${{ env.MVN_SETS_OPTS }} ${{ env.MVN_SIGN_OPTS }} ${{ env.MVN_TEST_OPTS_N }} ${{ env.MVN_DEPLOY_OPTS }} help:active-profiles deploy

27 changes: 4 additions & 23 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
paths-ignore:
# - '.github/**'
- '.run/**'
# - '.m2/**'
- '.m2/**'
- '.repo/**'


Expand All @@ -22,6 +22,9 @@ env:
GITHUB_UPLOAD_DIR: ${{ github.workspace }}/staging
GITHUB_UPLOAD_NAME: ${{ github.event.repository.name }}.zip
GITHUB_BRANCH_NAME: ${{ github.ref_name }}
GITHUB_DISTRIB_URL: https://maven.pkg.github.com
GITHUB_DISTRIB_REPO_SS: The-oGlow/Awesome-Snap-Shots
GITHUB_DISTRIB_REPO_REL: The-oGlow/Central-Awesome-Index
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PCK_READ_TOKEN: ${{ secrets.PCK_READ_TOKEN }}
PCK_WRITE_TOKEN: ${{ secrets.PCK_WRITE_TOKEN }}
Expand All @@ -35,11 +38,6 @@ env:
MVN_BUILD_OPTS: -fae -Dmaven.test.failure.ignore=true
MVN_CLI_OPTS: -ff
MVN_DEPLOY_OPTS: -Pdeploy-jfrog -DfastBuild -DretryFailedDeploymentCount=10
MVN_DISTRIB_URL: https://maven.pkg.github.com
MVN_DISTRIB_REPO_SS: The-oGlow/Awesome-Snap-Shots
MVN_DISTRIB_REPO_REL: The-oGlow/Central-Awesome-Index
CHK_FILE: com/glowa-net/maven/parent/global-appl-pom/3-SNAPSHOT/maven-metadata.xml
CHK_FUNC: echo SUCCESS || echo FAIL

# Maven Sign Configuration
MVN_SIGN_OPTS: -P!generate-gpgkey -P!sign-jar
Expand Down Expand Up @@ -73,13 +71,6 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
# - name: validate deploy repos
# run: |
# curl -fH "Authorization: Bearer ${{ secrets.PCK_READ_TOKEN }}" "${{ env.MVN_DISTRIB_URL }}/${{ env.MVN_DISTRIB_REPO_SS }}/${{ env.CHK_FILE }}" && ${{ env.CHK_FUNC }}
# curl -fH "Authorization: Bearer ${{ secrets.PCK_WRITE_TOKEN }}" "${{ env.MVN_DISTRIB_URL }}/${{ env.MVN_DISTRIB_REPO_SS }}/${{ env.CHK_FILE }}" && ${{ env.CHK_FUNC }}
# curl -f -u "${{ env.GITHUB_ACTOR }}:${{ secrets.PCK_WRITE_TOKEN }}" "${{ env.MVN_DISTRIB_URL }}/${{ env.MVN_DISTRIB_REPO_SS }}/${{ env.CHK_FILE }}" && ${{ env.CHK_FUNC }}
# curl -f -u "${{ env.GITHUB_ACTOR }}:${{ secrets.GITHUB_TOKEN }}" "${{ env.MVN_DISTRIB_URL }}/${{ env.MVN_DISTRIB_REPO_SS }}/${{ env.CHK_FILE }}" && ${{ env.CHK_FUNC }}

- name: checkout
uses: actions/checkout@v3.0.2
with:
Expand All @@ -104,16 +95,6 @@ jobs:
key: ${{ matrix.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ matrix.os }}-m2

#- name: maven settings
# uses: s4u/maven-settings-action@v2.6.0
# with:
# servers: '[{"id": "coding.github.ss", "username": "${env.GITHUB_ACTOR}", "password": "${env.GITHUB_TOKEN}"}, {"id": "coding.github.ss.deploy", "username": "${env.GITHUB_ACTOR}", "password": "${env.GITHUB_TOKEN}"}]'
# with:
# servers: '[{ "id": "coding.github.ss", "username": "${{ github.github_actor }}", "configuration": { "httpHeaders": { "property": { "name": "Authorization", "value": "Bearer ${{ secrets.PCK_READ_TOKEN }}" }}}}, { "id": "coding.github.ss.deploy", "username": "${{ github.github_actor }}", "configuration": { "httpHeaders": { "property": { "name": "Authorization", "value": "Bearer ${{ secrets.PCK_WRITE_TOKEN }}" }}}}]'

#- name: show settings
# run: cat ${{ env.MVN_HOME_DIR }}/settings.xml

- name: show settings
run: cat ${{ github.workspace}}/.m2/settings.xml

Expand Down
165 changes: 139 additions & 26 deletions .m2/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,133 @@
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd"
xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<servers>
<!-- Github with user -->
<!-- Github -->
<!-- ============================================== -->
<server>
<id>coding.github</id>
<configuration>
<httpHeaders>
<property>
<name>Authorization</name>
<value>Bearer ${env.PCK_READ_TOKEN}</value>
</property>
</httpHeaders>
</configuration>
</server>
<server>
<id>coding.github.ss</id>
<configuration>
<httpHeaders>
<property>
<name>Authorization</name>
<value>Bearer ${env.PCK_READ_TOKEN}</value>
</property>
</httpHeaders>
</configuration>
</server>
<server>
<id>coding.github.deploy</id>
<configuration>
<httpHeaders>
<property>
<name>Authorization</name>
<value>Bearer ${env.PCK_WRITE_TOKEN}</value>
</property>
</httpHeaders>
</configuration>
</server>
<server>
<id>coding.github.ss.deploy</id>
<configuration>
<httpHeaders>
<property>
<name>Authorization</name>
<value>Bearer ${env.PCK_WRITE_TOKEN}</value>
</property>
</httpHeaders>
</configuration>
</server>
<!-- Github with user -->
<!-- ============================================== -->
<server>
<id>coding.github.user</id>
<username>${env.GITHUB_ACTOR}</username>
<password>${env.PCK_READ_TOKEN}</password>
</server>
<server>
<id>coding.github.ss</id>
<id>coding.github.ss.user</id>
<username>${env.GITHUB_ACTOR}</username>
<password>${env.PCK_READ_TOKEN}</password>
</server>
<server>
<id>coding.github.deploy</id>
<id>coding.github.deploy.user</id>
<username>${env.GITHUB_ACTOR}</username>
<password>${env.PCK_WRITE_TOKEN}</password>
</server>
<server>
<id>coding.github.ss.deploy</id>
<id>coding.github.ss.deploy.user</id>
<username>${env.GITHUB_ACTOR}</username>
<password>${env.PCK_WRITE_TOKEN}</password>
</server>
<!-- Gitlab -->
<!-- ============================================== -->
<server>
<id>coding.gitlab</id>
<configuration>
<httpHeaders>
<property>
<name>Private-Token</name>
<value>${env.CI_JOB_TOKEN}</value>
</property>
</httpHeaders>
</configuration>
</server>
<server>
<id>coding.gitlab.deploy-ss</id>
<configuration>
<httpHeaders>
<property>
<name>Private-Token</name>
<value>${env.CI_JOB_TOKEN}</value>
</property>
</httpHeaders>
</configuration>
</server>
<server>
<id>coding.gitlab.deploy</id>
<configuration>
<httpHeaders>
<property>
<name>Private-Token</name>
<value>${env.CI_JOB_TOKEN}</value>
</property>
</httpHeaders>
</configuration>
</server>
<!-- JFrog -->
<!-- ============================================== -->
<server>
<id>carloranso.jfrog.read</id>
<configuration>
<httpHeaders>
<property>
<name>Authorization</name>
<value>Bearer ${env.JF_WRITE_TOKEN}</value>
</property>
</httpHeaders>
</configuration>
</server>
<server>
<id>carloranso.jfrog.read-ss</id>
<configuration>
<httpHeaders>
<property>
<name>Authorization</name>
<value>Bearer ${env.JF_WRITE_TOKEN}</value>
</property>
</httpHeaders>
</configuration>
</server>
<server>
<id>carloranso.jfrog.deploy</id>
<configuration>
Expand All @@ -49,16 +152,33 @@
</configuration>
</server>
</servers>

<profiles>
<profile>
<id>profile-github</id>
<activation>
<property>
<name>env.GITHUB_ACTOR</name>
</property>
</activation>
</profile>
<!--
<profile>
<id>profile-github</id>
<activation>
<property>
<name>env.GITHUB_ACTOR</name>
</property>
</activation>
</profile>
<profile>
<id>profile-gitlab</id>
<activation>
<property>
<name>env.GITLAB_USER_LOGIN</name>
</property>
</activation>
</profile>
<profile>
<id>profile-jfrog</id>
<activation>
<property>
<name>env.JF_USER</name>
</property>
</activation>
</profile>
-->
<profile>
<!--
Description : Define repositories for Github
Expand Down Expand Up @@ -125,24 +245,11 @@
</pluginRepositories>
</profile>

<profile>
<id>profile-gitlab</id>
<activation>
<property>
<name>env.GITLAB_USER_LOGIN</name>
</property>
</activation>
</profile>
<profile>
<!--
Description : Define repositories for Gitlab
-->
<id>repository-gitlab</id>
<activation>
<property>
<name>env.GITLAB_USER_LOGIN</name>
</property>
</activation>
<!-- Section Repositories -->
<!-- ============================================== -->
<repositories>
Expand Down Expand Up @@ -248,7 +355,13 @@
</pluginRepositories>
</profile>
</profiles>

<activeProfiles>
<!--
<activeProfile>repository-github</activeProfile>
<activeProfile>repository-gitlab</activeProfile>
-->
<activeProfile>repository-jfrog</activeProfile>
</activeProfiles>

</settings>

0 comments on commit 6c1c8b6

Please sign in to comment.