Merge pull request #276 from ckm007/develop #160
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Maven Package upon a push | |
on: | |
release: | |
types: [published] | |
pull_request: | |
types: [opened, reopened, synchronize] | |
branches: | |
- '!release-branch' | |
- release-1* | |
- 1.* | |
- develop* | |
- MOSIP* | |
workflow_dispatch: | |
inputs: | |
message: | |
description: 'Message for manually triggering' | |
required: false | |
default: 'Triggered for Updates' | |
type: string | |
push: | |
branches: | |
- '!release-branch' | |
- release-1* | |
- master | |
- 1.* | |
- develop* | |
- MOSIP* | |
jobs: | |
build-kafka-admin-client: | |
uses: mosip/kattu/.github/workflows/maven-build.yml@master-java21 | |
with: | |
SERVICE_LOCATION: ./kafka-admin-client | |
BUILD_ARTIFACT: kafka-admin-client | |
secrets: | |
OSSRH_USER: ${{ secrets.OSSRH_USER }} | |
OSSRH_SECRET: ${{ secrets.OSSRH_SECRET }} | |
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} | |
GPG_SECRET: ${{ secrets.GPG_SECRET }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} | |
publish-to-nexus-kafka-admin-client: | |
if: "${{ !contains(github.ref, 'master') && github.event_name != 'pull_request' && github.event_name != 'release' && github.event_name != 'prerelease' && github.event_name != 'publish' }}" | |
needs: build-kafka-admin-client | |
uses: mosip/kattu/.github/workflows/maven-publish-to-nexus.yml@master-java21 | |
with: | |
SERVICE_LOCATION: ./kafka-admin-client | |
secrets: | |
OSSRH_URL: ${{ secrets.OSSRH_SNAPSHOT_URL }} | |
OSSRH_USER: ${{ secrets.OSSRH_USER }} | |
OSSRH_SECRET: ${{ secrets.OSSRH_SECRET }} | |
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} | |
GPG_SECRET: ${{ secrets.GPG_SECRET }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} | |
sonar-analysis-kafka-admin-client: | |
needs: build-kafka-admin-client | |
if: "${{ github.event_name != 'pull_request' }}" | |
uses: mosip/kattu/.github/workflows/maven-sonar-analysis.yml@master-java21 | |
with: | |
SERVICE_LOCATION: ./kafka-admin-client | |
PROJECT_KEY: 'mosip_kafka-admin-client' | |
secrets: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
ORG_KEY: ${{ secrets.ORG_KEY }} | |
OSSRH_USER: ${{ secrets.OSSRH_USER }} | |
OSSRH_SECRET: ${{ secrets.OSSRH_SECRET }} | |
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} | |
GPG_SECRET: ${{ secrets.GPG_SECRET }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} | |
build-consolidator: | |
needs: build-kafka-admin-client | |
env: | |
SERVICE_LOCATION: 'consolidator' | |
BUILD_ARTIFACT: 'consolidator' | |
KAFKA_ADMIN_BUILD_ARTIFACT: 'kafka-admin-client' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: 17 | |
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml | |
settings-path: ${{ github.workspace }} # location for the settings.xml file | |
- name: Download kafka-admin-client artifact | |
uses: actions/download-artifact@v1 | |
with: | |
name: ${{ env.KAFKA_ADMIN_BUILD_ARTIFACT }} | |
path: ./ | |
- name: Unzip the kafka-admin-client | |
run: | | |
unzip ${{ env.KAFKA_ADMIN_BUILD_ARTIFACT }}.zip -d ${{ env.SERVICE_LOCATION }} | |
- name: Setup branch and env | |
run: | | |
# Strip git ref prefix from version | |
echo "BRANCH_NAME=$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" >> $GITHUB_ENV | |
echo "GPG_TTY=$(tty)" >> $GITHUB_ENV | |
- name: Install ballerina | |
run: | | |
wget -q --show-progress https://dist.ballerina.io/downloads/2201.9.0/ballerina-2201.9.0-swan-lake-linux-x64.deb -O ballerina-linux-installer-x64.deb | |
sudo dpkg -i ballerina-linux-installer-x64.deb | |
- name: Hub-service build | |
run: | | |
bal build ./${{ env.SERVICE_LOCATION }} | |
- name: Ready the springboot artifacts | |
if: ${{ !contains(github.ref, 'master') || !contains(github.ref, 'main') }} | |
run: | | |
## FIND JARS & COPY ONLY EXECUTABLE JARs STORED UNDER TARGET DIRECTORY | |
cd ${{ env.SERVICE_LOCATION }} | |
find . -path '*/target/bin/*' -name '*.jar' -type f -exec zip ${{ env.BUILD_ARTIFACT }}.zip {} + | |
- name: Upload the springboot jars | |
if: ${{ !contains(github.ref, 'master') || !contains(github.ref, 'main') }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.BUILD_ARTIFACT }} | |
path: ./${{ env.SERVICE_LOCATION }}/${{ env.BUILD_ARTIFACT }}.zip | |
- uses: 8398a7/action-slack@v3 | |
with: | |
status: ${{ job.status }} | |
fields: repo,message,author,commit,workflow,job # selectable (default: repo,message) | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required | |
if: failure() # Pick up events even if the job fails or is canceled. | |
build-consolidator-dockers: | |
needs: build-consolidator | |
uses: mosip/kattu/.github/workflows/docker-build.yml@master | |
with: | |
SERVICE_LOCATION: 'consolidator' | |
SERVICE_NAME: 'consolidator-websub-service' | |
BUILD_ARTIFACT: 'consolidator' | |
ONLY_DOCKER: true | |
secrets: | |
DEV_NAMESPACE_DOCKER_HUB: ${{ secrets.DEV_NAMESPACE_DOCKER_HUB }} | |
ACTOR_DOCKER_HUB: ${{ secrets.ACTOR_DOCKER_HUB }} | |
RELEASE_DOCKER_HUB: ${{ secrets.RELEASE_DOCKER_HUB }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_DEVOPS }} | |
build-websub: | |
needs: build-kafka-admin-client | |
env: | |
SERVICE_LOCATION: 'hub' | |
BUILD_ARTIFACT: 'websub-service' | |
KAFKA_ADMIN_BUILD_ARTIFACT: 'kafka-admin-client' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: 17 | |
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml | |
settings-path: ${{ github.workspace }} # location for the settings.xml file | |
- name: Download kafka-admin-client artifact | |
uses: actions/download-artifact@v1 | |
with: | |
name: ${{ env.KAFKA_ADMIN_BUILD_ARTIFACT }} | |
path: ./ | |
- name: Unzip the kafka-admin-client | |
run: | | |
unzip ${{ env.KAFKA_ADMIN_BUILD_ARTIFACT }}.zip -d ${{ env.SERVICE_LOCATION }} | |
- name: Setup branch and env | |
run: | | |
# Strip git ref prefix from version | |
echo "BRANCH_NAME=$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" >> $GITHUB_ENV | |
echo "GPG_TTY=$(tty)" >> $GITHUB_ENV | |
- name: Install ballerina | |
run: | | |
wget -q --show-progress https://dist.ballerina.io/downloads/2201.9.0/ballerina-2201.9.0-swan-lake-linux-x64.deb -O ballerina-linux-installer-x64.deb | |
sudo dpkg -i ballerina-linux-installer-x64.deb | |
- name: Hub-service build | |
run: | | |
bal build ./${{ env.SERVICE_LOCATION }} | |
- name: Ready the springboot artifacts | |
if: ${{ !contains(github.ref, 'master') || !contains(github.ref, 'main') }} | |
run: | | |
## FIND JARS & COPY ONLY EXECUTABLE JARs STORED UNDER TARGET DIRECTORY | |
cd ${{ env.SERVICE_LOCATION }} | |
find . -path '*/target/bin/*' -name '*.jar' -type f -exec zip ${{ env.BUILD_ARTIFACT }}.zip {} + | |
- name: Upload the springboot jars | |
if: ${{ !contains(github.ref, 'master') || !contains(github.ref, 'main') }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.BUILD_ARTIFACT }} | |
path: ./${{ env.SERVICE_LOCATION }}/${{ env.BUILD_ARTIFACT }}.zip | |
- uses: 8398a7/action-slack@v3 | |
with: | |
status: ${{ job.status }} | |
fields: repo,message,author,commit,workflow,job # selectable (default: repo,message) | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required | |
if: failure() # Pick up events even if the job fails or is canceled. | |
build-websub-dockers: | |
needs: build-websub | |
uses: mosip/kattu/.github/workflows/docker-build.yml@master | |
with: | |
SERVICE_LOCATION: 'hub' | |
SERVICE_NAME: 'websub-service' | |
BUILD_ARTIFACT: 'websub-service' | |
ONLY_DOCKER: true | |
secrets: | |
DEV_NAMESPACE_DOCKER_HUB: ${{ secrets.DEV_NAMESPACE_DOCKER_HUB }} | |
ACTOR_DOCKER_HUB: ${{ secrets.ACTOR_DOCKER_HUB }} | |
RELEASE_DOCKER_HUB: ${{ secrets.RELEASE_DOCKER_HUB }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_DEVOPS }} |