Skip to content

Commit

Permalink
maven central publishing fixes (#2760)
Browse files Browse the repository at this point in the history
* maven central publishing fixes

Signed-off-by: Henry Avetisyan <[email protected]>

* action to execute full build on main branch

Signed-off-by: Henry Avetisyan <[email protected]>

* add github actions badge

Signed-off-by: Henry Avetisyan <[email protected]>

---------

Signed-off-by: Henry Avetisyan <[email protected]>
  • Loading branch information
havetisyan authored Oct 10, 2024
1 parent 86801f8 commit b9c9b43
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 27 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/main-branch-push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Main Branch build

on:
push:
branches:
- 'master'

env:
GOLANG_VERSION: 1.22
NODEJS_VERSION: 18
JAVA_VERSION_FULL_BUILD: 17
JAVA_VERSION_CLIENT_BUILD: 11
JAVA_DISTRO: temurin
JAVA_ARCH: x64

jobs:
athenz-build:
runs-on: ubuntu-latest-4-cores
steps:
- name: Checkout repository
id: checkout
uses: actions/checkout@v4

- name: Setup Golang
id: setup-go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GOLANG_VERSION }}

- name: Setup Node
id: setup-node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODEJS_VERSION }}

- name: Setup Java
id: setup-java
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION_FULL_BUILD }}
distribution: ${{ env.JAVA_DISTRO }}
architecture: ${{ env.JAVA_ARCH }}

- name: Setup ZMS DB Schema file
run: cp servers/zms/schema/zms_server.sql servers/zms/src/test/resources/mysql

- name: Build Athenz
run: mvn -B install
24 changes: 9 additions & 15 deletions .github/workflows/ossrh-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ on:

env:
GOLANG_VERSION: 1.22
NODEJS_VERSION: 18
JAVA_VERSION_SERVER_BUILD: 17
JAVA_VERSION_CLIENT_BUILD: 11
JAVA_DISTRO: temurin
JAVA_ARCH: x64

jobs:
server-publish:
client-publish:
runs-on: ubuntu-latest-4-cores
steps:
- name: Checkout repository
Expand All @@ -27,31 +26,26 @@ jobs:
with:
go-version: ${{ env.GOLANG_VERSION }}

- name: Setup Node
id: setup-node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODEJS_VERSION }}

- name: Setup Java
id: setup-java
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION_SERVER_BUILD }}
java-version: ${{ env.JAVA_VERSION_CLIENT_BUILD }}
distribution: ${{ env.JAVA_DISTRO }}
architecture: ${{ env.JAVA_ARCH }}

- name: Build and Publish Server Modules
run: actions/scripts/publish.sh server
- name: Build and Publish Client Modules
run: actions/scripts/publish.sh client
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}
MAVEN_GPG_KEY: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }}
PUBLISH_SKIP_PACKAGES: ${{ secrets.PUBLISH_SKIP_PACKAGES }}

client-publish:
server-publish:
runs-on: ubuntu-latest-4-cores
needs: client-publish
steps:
- name: Checkout repository
id: checkout
Expand All @@ -67,12 +61,12 @@ jobs:
id: setup-java
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION_CLIENT_BUILD }}
java-version: ${{ env.JAVA_VERSION_SERVER_BUILD }}
distribution: ${{ env.JAVA_DISTRO }}
architecture: ${{ env.JAVA_ARCH }}

- name: Build and Publish Client Modules
run: actions/scripts/publish.sh client
- name: Build and Publish Server Modules
run: actions/scripts/publish.sh server
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# Athenz

[![GitHub_Actions Workflow](https://github.com/AthenZ/athenz/actions/workflows/main-branch-push.yaml/badge.svg)](https://github.com/AthenZ/athenz/actions)
[![SourceSpy Dashboard](https://sourcespy.com/shield.svg)](https://sourcespy.com/github/athenzathenz/)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/4681/badge)](https://bestpractices.coreinfrastructure.org/projects/4681)
[![Licenses](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2FAthenZ%2Fathenz.svg?type=shield)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2FAthenZ%2Fathenz?ref=badge_shield)
Expand Down
21 changes: 12 additions & 9 deletions actions/scripts/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function deployProject ()
then
echo "Package $1 already published. Skipping..."
else
until mvn -B deploy -P ossrh -Dmaven.test.skip=true --projects $1
until mvn -B deploy -P ossrh -Dmaven.test.skip=true --projects $1 --settings actions/settings/settings-publish.xml
do
[[ counter -eq $max_retry ]] && echo "Failed to deploy package $1" && exit 1
counter=$(( $counter + 1 ))
Expand All @@ -41,16 +41,19 @@ then
deployProject "com.yahoo.athenz:athenz-msd-java-client"
deployProject "com.yahoo.athenz:athenz-gcp-zts-creds"
else
mvn -B --projects core/zms -Dmaven.test.skip=true install
mvn -B --projects core/zts -Dmaven.test.skip=true install
mvn -B --projects libs/java/auth_core -Dmaven.test.skip=true install
mvn -B --projects libs/java/client_common -Dmaven.test.skip=true install
mvn -B --projects libs/java/cert_refresher -Dmaven.test.skip=true install
mvn -B --projects clients/java/zms -Dmaven.test.skip=true install
mvn -B --projects clients/java/zts -Dmaven.test.skip=true install
mvn -B install --projects "com.yahoo.athenz:athenz" -Dmaven.test.skip=true
mvn -B install --projects "com.yahoo.athenz:athenz-zms-core" -Dmaven.test.skip=true
mvn -B install --projects "com.yahoo.athenz:athenz-zts-core" -Dmaven.test.skip=true
mvn -B install --projects "com.yahoo.athenz:athenz-msd-core" -Dmaven.test.skip=true
mvn -B install --projects "com.yahoo.athenz:athenz-auth-core" -Dmaven.test.skip=true
mvn -B install --projects "com.yahoo.athenz:athenz-client-common" -Dmaven.test.skip=true
mvn -B install --projects "com.yahoo.athenz:athenz-cert-refresher" -Dmaven.test.skip=true
mvn -B install --projects "com.yahoo.athenz:athenz-zms-java-client" -Dmaven.test.skip=true
mvn -B install --projects "com.yahoo.athenz:athenz-zts-java-client" -Dmaven.test.skip=true
deployProject "com.yahoo.athenz:athenz-server-common"
deployProject "com.yahoo.athenz:athenz-server-k8s-common"
deployProject "com.yahoo.athenz:athenz-dynamodb-client-factory"
deployProject "com.yahoo.athenz:athenz-server-aws-common"
deployProject "com.yahoo.athenz:athenz-instance-provider"
deployProject "com.yahoo.athenz:athenz-syncer-common"
deployProject "com.yahoo.athenz:athenz-instance-provider"
fi
9 changes: 9 additions & 0 deletions actions/settings/settings-publish.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<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">
<servers>
<server>
<id>ossrh</id>
<username>${env.OSSRH_USERNAME}</username>
<password>${env.OSSRH_TOKEN}</password>
</server>
</servers>
</settings>
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,14 @@
<module>libs/java/auth_core</module>
<module>libs/java/client_common</module>
<module>libs/java/cert_refresher</module>
<module>clients/java/zms</module>
<module>clients/java/zts</module>
<module>libs/java/server_common</module>
<module>libs/java/server_k8s_common</module>
<module>libs/java/dynamodb_client_factory</module>
<module>libs/java/server_aws_common</module>
<module>libs/java/syncer_common</module>
<module>libs/java/instance_provider</module>
<module>libs/java/dynamodb_client_factory</module>
<module>clients/java/zms</module>
<module>clients/java/zts</module>
<module>clients/java/zpe</module>
<module>clients/java/msd</module>
<module>libs/java/gcp_zts_creds</module>
Expand Down

0 comments on commit b9c9b43

Please sign in to comment.