From d738f3bc1f4940015b3a824d1f11b64a7f1ddb6c Mon Sep 17 00:00:00 2001 From: skyflow-shravan Date: Tue, 19 Nov 2024 20:23:17 +0530 Subject: [PATCH 1/5] SK-1752 workflow for internal release --- .github/workflows/internal-release.yml | 39 +++++++++++++++ .github/workflows/release.yml | 2 +- pom.xml | 66 +++++++++++++++++--------- 3 files changed, 83 insertions(+), 24 deletions(-) create mode 100644 .github/workflows/internal-release.yml diff --git a/.github/workflows/internal-release.yml b/.github/workflows/internal-release.yml new file mode 100644 index 00000000..1bacef24 --- /dev/null +++ b/.github/workflows/internal-release.yml @@ -0,0 +1,39 @@ +name: Publish package to the JFROG Artifactory +on: + push: + tags: '*.*.*' + paths-ignore: + - "pom.xml" + - "*.md" + branches: + - release/* + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Set up Jfrog artifactory + uses: actions/setup-java@v1 + with: + java-version: '1.8' + distribution: 'adopt' + server-id: central + server-username: JFROG_USERNAME + server-password: JFROG_PASSWORD + gpg-private-key: ${{ secrets.JFROG_GPG_KEY }} # Value of the GPG private key to import + gpg-passphrase: JFROG_GPG_PASSPHRASE # env variable for GPG private key passphrase + + - name: create-json + id: create-json + uses: jsdaniell/create-json@1.1.2 + with: + name: "credentials.json" + json: ${{ secrets.TEST_CREDENTIALS_FILE_STRING }} + + - name: Publish package to Jfrog Artifactory + run: mvn clean deploy -P jfrog + env: + JFROG_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} + JFROG_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} + JFROG_GPG_PASSPHRASE: ${{ secrets.JFROG_GPG_PASSPHRASE }} \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 02c7b612..f30dda26 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,7 +26,7 @@ jobs: json: ${{ secrets.TEST_CREDENTIALS_FILE_STRING }} - name: Publish package to Maven Central - run: mvn --batch-mode deploy + run: mvn --batch-mode deploy -P maven-central env: MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} diff --git a/pom.xml b/pom.xml index ea4cbd29..2c0cc09f 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.skyflow skyflow-java - 1.15.0 + 1.15.0-v2dev1.0 jar ${project.groupId}:${project.artifactId} @@ -44,17 +44,6 @@ 1.3.5 - - - ossrh - https://s01.oss.sonatype.org/content/repositories/snapshots - - - ossrh - https://s01.oss.sonatype.org/service/local/staging/deploy/maven2 - - - @@ -132,17 +121,17 @@ - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.7 - true - - ossrh - https://s01.oss.sonatype.org/ - true - - + + + + + + + + + + + org.apache.maven.plugins maven-source-plugin @@ -252,4 +241,35 @@ + + + maven-central + + + ossrh + https://s01.oss.sonatype.org/service/local/staging/deploy/maven2 + + + ossrh + https://s01.oss.sonatype.org/content/repositories/snapshots + + + + + jfrog + + + central + prekarilabs.jfrog.io-releases + https://prekarilabs.jfrog.io/artifactory/skyflow-java + + + snapshots + prekarilabs.jfrog.io-snapshots + https://prekarilabs.jfrog.io/artifactory/skyflow-java + + + + + \ No newline at end of file From 9a09424795e3ae50b7ac4873d3a74355e5db9fc4 Mon Sep 17 00:00:00 2001 From: skyflow-vivek Date: Tue, 19 Nov 2024 21:27:27 +0530 Subject: [PATCH 2/5] SK-1623 Remove generated code from coverage params --- pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/pom.xml b/pom.xml index 2c0cc09f..9531a77c 100644 --- a/pom.xml +++ b/pom.xml @@ -178,6 +178,7 @@ **/example/* + **/generated/rest/** From 8b7a0e8bea5b1da472ce6069bd34682572c0df91 Mon Sep 17 00:00:00 2001 From: skyflow-shravan Date: Tue, 19 Nov 2024 21:42:35 +0530 Subject: [PATCH 3/5] SK-1752 workflow for internal release --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9531a77c..b1667906 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.skyflow skyflow-java - 1.15.0-v2dev1.0 + 1.15.0-v2dev2.0 jar ${project.groupId}:${project.artifactId} From 34ee85f779f691501f6f6f4f87e164ef6d9e57d4 Mon Sep 17 00:00:00 2001 From: skyflow-shravan Date: Tue, 19 Nov 2024 22:03:42 +0530 Subject: [PATCH 4/5] SK-1753 add create env step --- .github/workflows/internal-release.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/internal-release.yml b/.github/workflows/internal-release.yml index 1bacef24..38d6424f 100644 --- a/.github/workflows/internal-release.yml +++ b/.github/workflows/internal-release.yml @@ -24,6 +24,13 @@ jobs: gpg-private-key: ${{ secrets.JFROG_GPG_KEY }} # Value of the GPG private key to import gpg-passphrase: JFROG_GPG_PASSPHRASE # env variable for GPG private key passphrase + - name: create env + id: create-env + run: | + touch .env + echo SKYFLOW_CREDENTIALS=${{ secrets.SKYFLOW_CREDENTIALS }} >> .env + echo TEST_EXPIRED_TOKEN=${{ secrets.TEST_EXPIRED_TOKEN }} >> .env + - name: create-json id: create-json uses: jsdaniell/create-json@1.1.2 From 3ac7d23e530708666b267439b24282cd4db74f4d Mon Sep 17 00:00:00 2001 From: skyflow-shravan Date: Wed, 20 Nov 2024 15:54:52 +0530 Subject: [PATCH 5/5] SK-1753 auto generate release version in pom.xml --- .github/workflows/internal-release.yml | 23 +++++++++++++-- pom.xml | 2 +- scripts/bump_version.sh | 40 ++++++++++++++++++++++++++ 3 files changed, 62 insertions(+), 3 deletions(-) create mode 100755 scripts/bump_version.sh diff --git a/.github/workflows/internal-release.yml b/.github/workflows/internal-release.yml index 38d6424f..17176e5e 100644 --- a/.github/workflows/internal-release.yml +++ b/.github/workflows/internal-release.yml @@ -24,14 +24,33 @@ jobs: gpg-private-key: ${{ secrets.JFROG_GPG_KEY }} # Value of the GPG private key to import gpg-passphrase: JFROG_GPG_PASSPHRASE # env variable for GPG private key passphrase - - name: create env + - name: Get Previous tag + id: previoustag + uses: WyriHaximus/github-action-get-previous-tag@v1 + with: + fallback: 1.0.0 + + - name: Bump Version + run: | + chmod +x ./scripts/bump_version.sh + ./scripts/bump_version.sh "${{ steps.previoustag.outputs.tag }}" "$(git rev-parse --short "$GITHUB_SHA")" + + - name: Commit changes + run: | + git config user.name ${{ github.actor }} + git config user.email ${{ github.actor }}@users.noreply.github.com + git add pom.xml + git commit -m "[AUTOMATED] Private Release ${{ steps.previoustag.outputs.tag }}-dev.$(git rev-parse --short $GITHUB_SHA)" + git push origin -f + + - name: Create env id: create-env run: | touch .env echo SKYFLOW_CREDENTIALS=${{ secrets.SKYFLOW_CREDENTIALS }} >> .env echo TEST_EXPIRED_TOKEN=${{ secrets.TEST_EXPIRED_TOKEN }} >> .env - - name: create-json + - name: Create credentials json id: create-json uses: jsdaniell/create-json@1.1.2 with: diff --git a/pom.xml b/pom.xml index b1667906..f8d043c2 100644 --- a/pom.xml +++ b/pom.xml @@ -273,4 +273,4 @@ - \ No newline at end of file + diff --git a/scripts/bump_version.sh b/scripts/bump_version.sh new file mode 100755 index 00000000..58ab83a5 --- /dev/null +++ b/scripts/bump_version.sh @@ -0,0 +1,40 @@ +# Input Arguments +Version=$1 +CommitHash=$2 +PomFile="../pom.xml" + +if [ -z "$Version" ]; then + echo "Error: Version argument is required." + exit 1 +fi + +# Update only the main project's +if [ -z "$CommitHash" ]; then + echo "Bumping main project version to $Version" + + awk -v version="$Version" ' + BEGIN { updated = 0 } + // && updated == 0 { + sub(/.*<\/version>/, "" version "") + updated = 1 + } + { print } + ' "$PomFile" > tempfile && cat tempfile > "$PomFile" && rm -f tempfile + + echo "--------------------------" + echo "Done. Main project version now at $Version" +else + echo "Bumping main project version to $Version-dev-$CommitHash" + + awk -v version="$Version-dev.$CommitHash" ' + BEGIN { updated = 0 } + // && updated == 0 { + sub(/.*<\/version>/, "" version "") + updated = 1 + } + { print } + ' "$PomFile" > tempfile && cat tempfile > "$PomFile" && rm -f tempfile + + echo "--------------------------" + echo "Done. Main project version now at $Version-dev.$CommitHash" +fi