From b9ab36f9301f0b5fe92a3a263f940c877bff7f8b Mon Sep 17 00:00:00 2001 From: skyflow-shravan Date: Tue, 19 Nov 2024 20:23:17 +0530 Subject: [PATCH 01/11] 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 1dc1b785..1bbca53f 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 @@ -253,4 +242,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 656272d73e1f7eb87f57e532065295b9c9e445e0 Mon Sep 17 00:00:00 2001 From: skyflow-shravan Date: Tue, 19 Nov 2024 21:42:35 +0530 Subject: [PATCH 02/11] 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 1bbca53f..90f9d592 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 57657d2421f468d7bbf1f454beab723a27ccf08a Mon Sep 17 00:00:00 2001 From: skyflow-shravan Date: Tue, 19 Nov 2024 22:03:42 +0530 Subject: [PATCH 03/11] 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 d09ff9428f59e02b82f8c03098c5c83c326a36ce Mon Sep 17 00:00:00 2001 From: skyflow-shravan Date: Wed, 20 Nov 2024 15:54:52 +0530 Subject: [PATCH 04/11] 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 90f9d592..b0686004 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 From b76fa831677a38f8dd572d16f9096b16c7f7aa03 Mon Sep 17 00:00:00 2001 From: skyflow-shravan Date: Wed, 20 Nov 2024 16:28:00 +0530 Subject: [PATCH 05/11] SK-1753 auto generate release version in pom.xml --- .github/workflows/internal-release.yml | 7 ++++++- scripts/bump_version.sh | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/internal-release.yml b/.github/workflows/internal-release.yml index 17176e5e..959f0000 100644 --- a/.github/workflows/internal-release.yml +++ b/.github/workflows/internal-release.yml @@ -7,6 +7,8 @@ on: - "*.md" branches: - release/* + pull-request: + - release/* jobs: publish: @@ -30,6 +32,9 @@ jobs: with: fallback: 1.0.0 + - name: Print working directory + run: pwd + - name: Bump Version run: | chmod +x ./scripts/bump_version.sh @@ -58,7 +63,7 @@ jobs: json: ${{ secrets.TEST_CREDENTIALS_FILE_STRING }} - name: Publish package to Jfrog Artifactory - run: mvn clean deploy -P jfrog + run: mvn clean deplo -P jfrog env: JFROG_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} JFROG_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} diff --git a/scripts/bump_version.sh b/scripts/bump_version.sh index 58ab83a5..d729ea63 100755 --- a/scripts/bump_version.sh +++ b/scripts/bump_version.sh @@ -1,7 +1,7 @@ # Input Arguments Version=$1 CommitHash=$2 -PomFile="../pom.xml" +PomFile="$GITHUB_WORKSPACE/pom.xml" if [ -z "$Version" ]; then echo "Error: Version argument is required." From 92eae6ab8976d9487544a9076a163c56c913b2bd Mon Sep 17 00:00:00 2001 From: skyflow-shravan Date: Wed, 20 Nov 2024 16:31:56 +0530 Subject: [PATCH 06/11] SK-1753 auto generate release version in pom.xml --- .github/workflows/internal-release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/internal-release.yml b/.github/workflows/internal-release.yml index 959f0000..829f0c29 100644 --- a/.github/workflows/internal-release.yml +++ b/.github/workflows/internal-release.yml @@ -6,9 +6,9 @@ on: - "pom.xml" - "*.md" branches: - - release/* - pull-request: - - release/* + branches: [ release/*, '*' ] + pull_request: + branches: [ release/* ] jobs: publish: From 167b1b41d17f3af7df16ca0524351dc9dc2bcf17 Mon Sep 17 00:00:00 2001 From: skyflow-shravan Date: Wed, 20 Nov 2024 16:38:55 +0530 Subject: [PATCH 07/11] SK-1753 auto generate release version in pom.xml --- .github/workflows/internal-release.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/internal-release.yml b/.github/workflows/internal-release.yml index 829f0c29..b5d40bcc 100644 --- a/.github/workflows/internal-release.yml +++ b/.github/workflows/internal-release.yml @@ -5,10 +5,9 @@ on: paths-ignore: - "pom.xml" - "*.md" - branches: - branches: [ release/*, '*' ] - pull_request: - branches: [ release/* ] + branches: [ release/*, '*' ] + pull_request: + branches: [ release/* ] jobs: publish: From 953903a3ff94f1cdac3542addaf250b22f8c2671 Mon Sep 17 00:00:00 2001 From: skyflow-shravan Date: Wed, 20 Nov 2024 16:45:43 +0530 Subject: [PATCH 08/11] SK-1753 auto generate release version in pom.xml --- .github/workflows/internal-release.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/internal-release.yml b/.github/workflows/internal-release.yml index b5d40bcc..4fbb156f 100644 --- a/.github/workflows/internal-release.yml +++ b/.github/workflows/internal-release.yml @@ -5,9 +5,8 @@ on: paths-ignore: - "pom.xml" - "*.md" - branches: [ release/*, '*' ] - pull_request: - branches: [ release/* ] + branches: + - release/* jobs: publish: @@ -31,9 +30,6 @@ jobs: with: fallback: 1.0.0 - - name: Print working directory - run: pwd - - name: Bump Version run: | chmod +x ./scripts/bump_version.sh From 817bdc4b9c447cf4bb6164d7c12c4954b9b014c3 Mon Sep 17 00:00:00 2001 From: skyflow-shravan Date: Wed, 20 Nov 2024 16:48:06 +0530 Subject: [PATCH 09/11] SK-1753 auto generate release version in pom.xml --- .github/workflows/internal-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/internal-release.yml b/.github/workflows/internal-release.yml index 4fbb156f..17176e5e 100644 --- a/.github/workflows/internal-release.yml +++ b/.github/workflows/internal-release.yml @@ -58,7 +58,7 @@ jobs: json: ${{ secrets.TEST_CREDENTIALS_FILE_STRING }} - name: Publish package to Jfrog Artifactory - run: mvn clean deplo -P jfrog + run: mvn clean deploy -P jfrog env: JFROG_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} JFROG_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} From 5e2d385dea430fbc503f3fba86a78667032a9310 Mon Sep 17 00:00:00 2001 From: skyflow-shravan Date: Wed, 20 Nov 2024 17:05:27 +0530 Subject: [PATCH 10/11] SK-1753 auto generate release version in pom.xml --- .github/workflows/internal-release.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/internal-release.yml b/.github/workflows/internal-release.yml index 17176e5e..5d82fda1 100644 --- a/.github/workflows/internal-release.yml +++ b/.github/workflows/internal-release.yml @@ -12,7 +12,11 @@ jobs: publish: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 + with: + ref: ${{ github.ref_name }} + fetch-depth: 0 + - name: Set up Jfrog artifactory uses: actions/setup-java@v1 with: From 5c482719042b8296e319110adb4cb21126b9ee7a Mon Sep 17 00:00:00 2001 From: skyflow-shravan Date: Wed, 20 Nov 2024 17:26:47 +0530 Subject: [PATCH 11/11] SK-1753 restore version in pom.xml --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b0686004..36544eb5 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.skyflow skyflow-java - 1.15.0-v2dev2.0 + 1.15.0 jar ${project.groupId}:${project.artifactId}