Skip to content

Commit 75f4863

Browse files
author
Komal Yadav
committed
Set up Maven profiles for release and snapshot
updated updated updated updated updated updated Set up Maven profiles for release and snapshot updated updated updated updated updated updated updated updated updated updated updated updated updated updated updated updated updated updated updated updated updated updated updated updated updated
1 parent f79f1b9 commit 75f4863

File tree

3 files changed

+147
-61
lines changed

3 files changed

+147
-61
lines changed

.github/workflows/tag-release.yml

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright © 2022 Cask Data, Inc.
1+
# Copyright © 2026 Cask Data, Inc.
22
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
33
# use this file except in compliance with the License. You may obtain a copy of
44
# the License at
@@ -21,16 +21,6 @@ jobs:
2121
if: ${{ github.ref_type == 'tag' }}
2222
steps:
2323

24-
- name: Get Secrets from GCP Secret Manager
25-
id: 'secrets'
26-
uses: 'google-github-actions/get-secretmanager-secrets@v0'
27-
with:
28-
secrets: |-
29-
CDAP_OSSRH_USERNAME:cdapio-github-builds/CDAP_OSSRH_USERNAME
30-
CDAP_OSSRH_PASSWORD:cdapio-github-builds/CDAP_OSSRH_PASSWORD
31-
CDAP_GPG_PASSPHRASE:cdapio-github-builds/CDAP_GPG_PASSPHRASE
32-
CDAP_GPG_PRIVATE_KEY:cdapio-github-builds/CDAP_GPG_PRIVATE_KEY
33-
3424
- name: Checkout Repository
3525
uses: actions/checkout@v4
3626
with:
@@ -44,25 +34,17 @@ jobs:
4434
restore-keys: |
4535
${{ runner.os }}-maven-${{ github.workflow }}
4636
47-
- name: Set up GPG conf
48-
run: |
49-
echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
50-
echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf
51-
52-
- name: Import GPG key
53-
run: |
54-
echo "$GPG_PRIVATE_KEY" > private.key
55-
gpg --import --batch private.key
56-
env:
57-
GPG_PRIVATE_KEY: ${{ steps.secrets.outputs.CDAP_GPG_PRIVATE_KEY }}
58-
5937
- name: Run tests
6038
run: mvn clean test -fae -T 2 -B -V -DcloudBuild -Dmaven.wagon.http.retryHandler.count=5 -Dmaven.wagon.httpconnectionManager.ttlSeconds=30
6139

62-
- name: Publish to Maven Central
63-
run: mvn clean -B -V -DskipTests deploy -P release -Dgpg.passphrase=$CDAP_GPG_PASSPHRASE -Dmaven.wagon.http.retryHandler.count=5 -Dmaven.wagon.httpconnectionManager.ttlSeconds=30
64-
env:
65-
CDAP_OSSRH_USERNAME: ${{ steps.secrets.outputs.CDAP_OSSRH_USERNAME }}
66-
CDAP_OSSRH_PASSWORD: ${{ steps.secrets.outputs.CDAP_OSSRH_PASSWORD }}
67-
CDAP_GPG_PASSPHRASE: ${{ steps.secrets.outputs.CDAP_GPG_PASSPHRASE }}
68-
MAVEN_OPTS: '-Xmx3200m'
40+
- name: Get Project Version
41+
id: get_version
42+
run: echo "VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT
43+
44+
- name: Submit Build to GCB
45+
id: gcb
46+
run: |
47+
gcloud builds submit . \
48+
--config=cloudbuild-release.yaml \
49+
--project='cdapio-github-builds' \
50+
--substitutions="_VERSION=${{ steps.get_version.outputs.VERSION }}"

cloudbuild-release.yaml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# Copyright © 2026 Cask Data, Inc.
2+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
3+
# use this file except in compliance with the License. You may obtain a copy of
4+
# the License at
5+
# http://www.apache.org/licenses/LICENSE-2.0
6+
# Unless required by applicable law or agreed to in writing, software
7+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
8+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
9+
# License for the specific language governing permissions and limitations under
10+
# the License.
11+
12+
steps:
13+
# - name: 'gcr.io/cloud-builders/gcloud'
14+
# id: setup-gpg
15+
# entrypoint: 'bash'
16+
# secretEnv: ['GPG_KEY']
17+
# args:
18+
# - '-c'
19+
# - |
20+
# set -e
21+
# export GNUPGHOME=/workspace/.gnupg
22+
# mkdir -p $$GNUPGHOME
23+
# chmod 700 $$GNUPGHOME
24+
#
25+
# echo "pinentry-mode loopback" >> $$GNUPGHOME/gpg.conf
26+
# echo "allow-loopback-pinentry" >> $$GNUPGHOME/gpg-agent.conf
27+
#
28+
# echo "$$GPG_KEY" | gpg --batch --import
29+
# echo "GPG key imported into $$GNUPGHOME."
30+
31+
- name: 'gcr.io/cloud-builders/mvn:3.8-jdk-8'
32+
id: maven-package
33+
entrypoint: 'mvn'
34+
args:
35+
- 'deploy'
36+
- '-B'
37+
- '-V'
38+
- '-DskipTests'
39+
- '-Pversion-release'
40+
- '-DaltDeploymentRepository=local::default::file:///workspace/target'
41+
- '-Dmaven.wagon.http.retryHandler.count=5'
42+
- '-Dmaven.wagon.httpconnectionManager.ttlSeconds=30'
43+
env:
44+
- 'GNUPGHOME=/workspace/.gnupg'
45+
# secretEnv: [ 'GPG_PASSPHRASE' ]
46+
47+
48+
# - name: 'bash'
49+
# id: create-exit-gate-manifest
50+
# entrypoint: 'bash'
51+
# args:
52+
# - '-c'
53+
# - |
54+
# set -e
55+
# MANIFEST_FILE="/workspace/publish_manifest.textproto"
56+
# echo '# -*- protobuffer -*-' > "$${MANIFEST_FILE}"
57+
# echo '# proto-file: security/opensource/exit_gate_v1/onboarded/proto/publishing_manifest.proto' >> "$${MANIFEST_FILE}"
58+
# echo '# proto-message: PublishingManifest' >> "$${MANIFEST_FILE}"
59+
# echo '' >> "$${MANIFEST_FILE}"
60+
# echo 'publish_all: true' >> "$${MANIFEST_FILE}"
61+
# echo "Created manifest file: $${MANIFEST_FILE}"
62+
# waitFor: ['maven-package']
63+
#
64+
# - name: 'gcr.io/cloud-builders/gsutil'
65+
# id: upload-exit-gate-manifest
66+
# entrypoint: 'bash'
67+
# args:
68+
# - '-c'
69+
# - |
70+
# set -e
71+
# GCS_MANIFEST_DIR="gs://oss-exit-gate-prod-projects-bucket/cloud-data-fusion/githubreleases/manifests/"
72+
# MANIFEST_FILE="/workspace/publish_manifest.textproto"
73+
# MANIFEST_FILENAME="release_${_VERSION}.textproto"
74+
# echo "Uploading manifest to $${GCS_MANIFEST_DIR}$${MANIFEST_FILENAME}"
75+
# gsutil cp "$${MANIFEST_FILE}" "$${GCS_MANIFEST_DIR}$${MANIFEST_FILENAME}"
76+
# echo "Manifest uploaded successfully."
77+
# waitFor: ['create-exit-gate-manifest']
78+
79+
80+
substitutions:
81+
_VERSION: '0.25.0-SNAPSHOT'
82+
83+
artifacts:
84+
mavenArtifacts:
85+
- repository: 'https://us-east1-maven.pkg.dev/komalyd-dev/my-test-maven-repo'
86+
deployFolder: '/workspace/target/'
87+
groupId: 'io.cdap.plugin'
88+
artifactId: 'google-cloud'
89+
version: '${_VERSION}'
90+
91+
options:
92+
requestedVerifyOption: VERIFIED
93+
machineType: 'E2_HIGHCPU_32'
94+
95+
96+
#availableSecrets:
97+
# secretManager:
98+
# - versionName: projects/cdapio-github-builds/secrets/CDAP_GPG_PRIVATE_KEY/versions/latest
99+
# env: 'GPG_KEY'
100+
# - versionName: projects/cdapio-github-builds/secrets/CDAP_GPG_PASSPHRASE/versions/latest
101+
# env: 'GPG_PASSPHRASE'

pom.xml

Lines changed: 34 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -904,6 +904,13 @@
904904
</dependencies>
905905

906906
<build>
907+
<extensions>
908+
<extension>
909+
<groupId>com.google.cloud.artifactregistry</groupId>
910+
<artifactId>artifactregistry-maven-wagon</artifactId>
911+
<version>2.2.5</version>
912+
</extension>
913+
</extensions>
907914
<testSourceDirectory>${testSourceLocation}</testSourceDirectory>
908915
<plugins>
909916
<plugin>
@@ -1058,7 +1065,13 @@
10581065
<!-- Profile for release. Includes signing of jars. -->
10591066
<profiles>
10601067
<profile>
1061-
<id>release</id>
1068+
<id>version-release</id>
1069+
<distributionManagement>
1070+
<repository>
1071+
<id>artifact-registry</id>
1072+
<url>artifactregistry://us-east1-maven.pkg.dev/komalyd-dev/my-test-maven-repo</url>
1073+
</repository>
1074+
</distributionManagement>
10621075
<build>
10631076
<plugins>
10641077
<!-- Source JAR -->
@@ -1129,36 +1142,26 @@
11291142
</executions>
11301143
</plugin>
11311144

1132-
<plugin>
1133-
<groupId>org.apache.maven.plugins</groupId>
1134-
<artifactId>maven-gpg-plugin</artifactId>
1135-
<version>1.5</version>
1136-
<configuration>
1137-
<passphrase>${gpg.passphrase}</passphrase>
1138-
<useAgent>${gpg.useagent}</useAgent>
1139-
</configuration>
1140-
<executions>
1141-
<execution>
1142-
<goals>
1143-
<goal>sign</goal>
1144-
</goals>
1145-
</execution>
1146-
</executions>
1147-
</plugin>
1148-
<plugin>
1149-
<groupId>org.sonatype.central</groupId>
1150-
<artifactId>central-publishing-maven-plugin</artifactId>
1151-
<version>0.8.0</version>
1152-
<extensions>true</extensions>
1153-
<configuration>
1154-
<publishingServerId>sonatype.release</publishingServerId>
1155-
<autoPublish>false</autoPublish>
1156-
<ignorePublishedComponents>true</ignorePublishedComponents>
1157-
</configuration>
1158-
</plugin>
1159-
</plugins>
1160-
</build>
1161-
</profile>
1145+
<!-- <plugin>-->
1146+
<!-- <groupId>org.apache.maven.plugins</groupId>-->
1147+
<!-- <artifactId>maven-gpg-plugin</artifactId>-->
1148+
<!-- <version>1.5</version>-->
1149+
<!-- <configuration>-->
1150+
<!-- <passphrase>${gpg.passphrase}</passphrase>-->
1151+
<!-- <useAgent>${gpg.useagent}</useAgent>-->
1152+
<!-- </configuration>-->
1153+
<!-- <executions>-->
1154+
<!-- <execution>-->
1155+
<!-- <goals>-->
1156+
<!-- <goal>sign</goal>-->
1157+
<!-- </goals>-->
1158+
<!-- </execution>-->
1159+
<!-- </executions>-->
1160+
<!-- </plugin>-->
1161+
</plugins>
1162+
</build>
1163+
</profile>
1164+
11621165
<profile>
11631166
<id>cloudBuild</id>
11641167
<activation>

0 commit comments

Comments
 (0)