-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated build, post_build & release pipelines (#27)
Co-authored-by: OmOmofonmwan <[email protected]>
- Loading branch information
1 parent
2998619
commit fba9322
Showing
4 changed files
with
116 additions
and
149 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,36 +11,34 @@ env: | |
BRANCH_NAME: ${{github.ref_name}} | ||
|
||
jobs: | ||
pr-verification: | ||
name: Pull Request Validation | ||
runs-on: ubuntu-24.04 | ||
if: github.event_name == 'pull_request' | ||
steps: | ||
- name: Pull Request Version Validation | ||
if: github.event_name == 'pull_request' | ||
uses: ikmdev/maven-pull-request-version-validation-action@main | ||
|
||
build-job: | ||
name: Build Job | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-java@v4 | ||
with: | ||
java-version: '21' | ||
distribution: 'zulu' | ||
|
||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
|
||
|
||
|
||
- name: Build Protoc Docker container | ||
uses: docker/build-push-action@v6 | ||
with: | ||
push: false | ||
context: . | ||
file: protoc.dockerfile | ||
tags: tinkar-schema-protoc:latest | ||
#outputs: type=docker,dest=/tmp/protocimage.tar | ||
|
||
# - name: Build C sharp Docker container | ||
# uses: docker/build-push-action@v6 | ||
# with: | ||
# push: false | ||
# context: . | ||
# file: csharp.dockerfile | ||
# tags: tinkar-schema-csharp:latest | ||
# #outputs: type=docker,dest=/tmp/csharpimage.tar | ||
|
||
- name: Generate Java Code | ||
run: | | ||
|
@@ -50,97 +48,9 @@ jobs: | |
run: | | ||
ls src/main/java-generated | ||
- name: build java code | ||
run: | | ||
./mvnw clean install \ | ||
--batch-mode \ | ||
-e \ | ||
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \ | ||
-Dmaven.build.cache.enabled=false \ | ||
-PcodeQuality | ||
- name: SonarCloud Build and analyze | ||
if: github.repository_owner == 'ikmdev' && github.event_name != 'pull_request' | ||
env: | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
SONAR_HOST_URL: ${{ 'https://sonarcloud.io/' }} | ||
SONAR_ORGANIZATION: ${{ github.repository_owner }} | ||
run: mvn verify sonar:sonar | ||
-Dsonar.organization=${{ github.repository_owner }} | ||
-Dsonar.sources=src/main/java-generated | ||
-Dsonar.projectKey=${{ github.repository_owner }}_${{ github.event.repository.name }} | ||
-Dsonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml | ||
-Dsonar.java.binaries=target/classes | ||
-Dsonar.tests=${{ '' }} | ||
|
||
publish_to_ossrh: | ||
name: Publish To Maven Central (OSSRH) | ||
runs-on: ubuntu-24.04 | ||
if: github.repository_owner == 'ikmdev' && github.ref_type == 'tag' | ||
needs: build-job | ||
steps: | ||
- name: Checkout Code Repository | ||
uses: actions/checkout@v4 | ||
- name: Build IKMDEV Code | ||
uses: ikmdev/[email protected] | ||
with: | ||
ref: ${{env.BRANCH_NAME}} | ||
branch_name: ${{env.BRANCH_NAME}} | ||
|
||
- name: Setup Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'zulu' | ||
java-version: '21' | ||
server-id: ossrh | ||
server-username: MAVEN_USERNAME | ||
server-password: MAVEN_CENTRAL_TOKEN | ||
gpg-private-key: ${{secrets.GPG_KEY}} | ||
gpg-passphrase: MAVEN_GPG_PASSPHRASE | ||
|
||
- name: Build Protoc Docker container | ||
uses: docker/build-push-action@v6 | ||
with: | ||
push: false | ||
context: . | ||
file: protoc.dockerfile | ||
tags: tinkar-schema-protoc:latest | ||
|
||
|
||
- name: Generate Java Code | ||
shell: bash | ||
run: | | ||
sudo docker run -v ./src/main/java-generated:/home/proto-builder/src/main/java-generated --rm tinkar-schema-protoc:latest | ||
- name: list java code | ||
shell: bash | ||
run: | | ||
ls src/main/java-generated | ||
- name: Maven Build | ||
shell: bash | ||
run: | | ||
./mvnw clean install -U \ | ||
--batch-mode \ | ||
-e \ | ||
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \ | ||
-Dmaven.build.cache.enabled=false \ | ||
-PcodeQuality | ||
- name: Publish To OSSRH (Maven Central Staging) | ||
shell: bash | ||
run: | | ||
./mvnw deploy -U\ | ||
--batch-mode \ | ||
-e \ | ||
-U \ | ||
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \ | ||
-DskipTests \ | ||
-DskipITs \ | ||
-Dmaven.main.skip \ | ||
-Dmaven.test.skip \ | ||
-DrepositoryId=ossrh \ | ||
-DrepositoryIdOSSRH='true' \ | ||
-PstageOSSRH \ | ||
-Dmaven.build.cache.enabled=false | ||
env: | ||
MAVEN_USERNAME: ${{secrets.OSSRH_TOKEN_USER}} | ||
MAVEN_CENTRAL_TOKEN: ${{secrets.OSSRH_TOKEN_PASS}} | ||
MAVEN_GPG_PASSPHRASE: ${{secrets.GPG_PASSPHRASE}} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Post Build Action | ||
|
||
run-name: 'Post Build Action -- ${{github.event.workflow_run.head_branch}}' | ||
|
||
on: | ||
workflow_run: | ||
workflows: | ||
- Build Workflow | ||
types: | ||
- completed | ||
|
||
|
||
|
||
jobs: | ||
post-build: | ||
name: Post Build Actions | ||
runs-on: ubuntu-24.04 | ||
if: github.event.workflow_run.conclusion == 'success' && github.repository_owner == 'ikmdev' | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: ${{github.event.workflow_run.head_repository.full_name}} | ||
ref: ${{github.event.workflow_run.head_branch}} | ||
|
||
- name: Build Protoc Docker container | ||
uses: docker/build-push-action@v6 | ||
with: | ||
push: false | ||
context: . | ||
file: protoc.dockerfile | ||
tags: tinkar-schema-protoc:latest | ||
|
||
- name: Generate Java Code | ||
run: | | ||
docker run -v ./src/main/java-generated:/home/proto-builder/src/main/java-generated --rm tinkar-schema-protoc:latest | ||
- name: list java code | ||
run: | | ||
ls src/main/java-generated | ||
- name: IKMDEV Post Build Action | ||
id: ikmdev_post_build | ||
uses: ikmdev/[email protected] | ||
with: | ||
nexus_repo_password: ${{secrets.EC2_NEXUS_PASSWORD}} | ||
branch_name: ${{github.event.workflow_run.head_branch}} | ||
github_token: ${{secrets.GITHUB_TOKEN}} | ||
ossrh_username: ${{secrets.OSSRH_TOKEN_USER}} | ||
ossrh_token: ${{secrets.OSSRH_TOKEN_PASS}} | ||
gpg_key: ${{secrets.GPG_KEY}} | ||
gpg_passphrase: ${{secrets.GPG_PASSPHRASE}} | ||
sonarcloud_token: ${{ secrets.SONAR_TOKEN }} | ||
sonarcloud_sources: 'src/main/java-generated' | ||
sonarcloud_tests: ${{ '' }} |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,28 @@ | ||
name: Release Workflow | ||
name: SemVer Release Workflow | ||
|
||
run-name: "Releasing ${{ github.event.repository.name }} #${{github.run_number}}" | ||
|
||
# Trigger workflow manually | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
release_version: | ||
type: string | ||
description: "(Optional) Custom Release Version" | ||
required: false | ||
version_type: | ||
description: 'Development version type to increment' | ||
required: true | ||
default: 'minor' | ||
type: choice | ||
options: | ||
- major | ||
- minor | ||
- patch | ||
|
||
env: | ||
BRANCH_NAME: ${{github.ref_name}} | ||
TRUNK_BRANCH_NAME: 'main' | ||
BRANCH_NAME: ${{ github.ref_name }} | ||
TRUNK_BRANCH_NAME: ${{ github.event.repository.default_branch }} | ||
|
||
jobs: | ||
release: | ||
|
@@ -19,16 +33,34 @@ jobs: | |
- name: Verify Branch | ||
if: env.BRANCH_NAME != env.TRUNK_BRANCH_NAME | ||
run: | | ||
echo "ERROR: Attempting to release from branch ${{env.BRANCH_NAME}}. Release from ${{env.TRUNK_BRANCH_NAME}} branch only" | ||
echo "ERROR: Attempting to release from branch ${{ env.BRANCH_NAME }}. Release from ${{ env.TRUNK_BRANCH_NAME }} branch only." | ||
exit 1 | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
with: | ||
token: ${{secrets.IKMDEVOPS_PAT_TOKEN}} | ||
|
||
|
||
- name: Build Protoc Docker container | ||
uses: docker/build-push-action@v6 | ||
with: | ||
push: false | ||
context: . | ||
file: protoc.dockerfile | ||
tags: tinkar-schema-protoc:latest | ||
|
||
- name: Generate Java Code | ||
run: | | ||
docker run -v ./src/main/java-generated:/home/proto-builder/src/main/java-generated --rm tinkar-schema-protoc:latest | ||
- name: list java code | ||
run: | | ||
ls src/main/java-generated | ||
- name: Release IKMDEV Code | ||
id: release_code | ||
uses: ikmdev/[email protected] | ||
- name: Shared Release Action | ||
uses: ikmdev/[email protected] | ||
with: | ||
ikmdevops_pat: ${{secrets.IKMDEVOPS_PAT_TOKEN}} | ||
version_type: ${{ github.event.inputs.version_type }} | ||
github_token: ${{secrets.GITHUB_TOKEN}} | ||
ossrh_username: ${{secrets.OSSRH_TOKEN_USER}} | ||
ossrh_token: ${{secrets.OSSRH_TOKEN_PASS}} | ||
gpg_key: ${{secrets.GPG_KEY}} | ||
gpg_passphrase: ${{secrets.GPG_PASSPHRASE}} | ||
release_version: ${{ github.event.inputs.release_version }} |