33 workflow_call :
44 inputs :
55 ref :
6- description : ' Git reference to use (e.g., main or branch name)'
6+ description : " Git reference to use (e.g., main or branch name)"
77 required : true
88 type : string
99
10- is-internal :
11- description : ' Flag for internal release'
12- required : true
13- type : boolean
14-
1510 server-id :
16- description : ' Id of the repository'
11+ description : " Id of the repository"
1712 required : true
1813 type : string
19-
14+
2015 profile :
21- description : ' Profile to pick from pom.xml'
16+ description : " Profile to pick from pom.xml"
17+ required : true
18+ type : string
19+
20+ tag :
21+ description : ' Release Tag'
2222 required : true
2323 type : string
2424 secrets :
3434 gpg-passphrase :
3535 required : true
3636
37+ skyflow-credentials :
38+ required : true
39+
40+ test-expired-token :
41+ required : true
42+
43+ test-reusable-token :
44+ required : true
45+
3746jobs :
3847 publish :
3948 runs-on : ubuntu-latest
4049 steps :
4150 - uses : actions/checkout@v2
4251 with :
43- ref : ${{ inputs.ref }}
4452 fetch-depth : 0
4553
4654 - name : Set up maven or jfrog repository
47- uses : actions/setup-java@v1
55+ uses : actions/setup-java@v4
4856 with :
49- java-version : ' 1.8 '
50- distribution : ' adopt'
57+ java-version : " 11 "
58+ distribution : " adopt"
5159 server-id : ${{ inputs.server-id }}
5260 server-username : SERVER_USERNAME
5361 server-password : SERVER_PASSWORD
5462 gpg-private-key : ${{ secrets.gpg-key }} # Value of the GPG private key to import
5563 gpg-passphrase : GPG_PASSPHRASE # env variable for GPG private key passphrase
64+
65+ - name : Resolve Branch for the Tagged Commit
66+ id : resolve-branch
67+ if : ${{ inputs.tag == 'beta' || inputs.tag == 'public' }}
68+ run : |
69+ TAG_COMMIT=$(git rev-list -n 1 ${{ github.ref_name }})
70+ BRANCH_NAME=$(git branch -r --contains $TAG_COMMIT | grep -o 'origin/.*' | sed 's|origin/||' | head -n 1)
71+ if [ -z "$BRANCH_NAME" ]; then
72+ echo "Error: Could not resolve branch for the tag."
73+ exit 1
74+ fi
75+ echo "Resolved Branch Name: $BRANCH_NAME"
76+ echo "branch_name=$BRANCH_NAME" >> $GITHUB_ENV
5677
5778 - name : Get Previous tag
5879 id : previoustag
6384 - name : Bump Version
6485 run : |
6586 chmod +x ./scripts/bump_version.sh
66- if ${{ inputs.is- internal }}; then
87+ if ${{ inputs.tag == ' internal' }}; then
6788 ./scripts/bump_version.sh "${{ steps.previoustag.outputs.tag }}" "$(git rev-parse --short "$GITHUB_SHA")"
6889 else
6990 ./scripts/bump_version.sh "${{ steps.previoustag.outputs.tag }}"
@@ -73,22 +94,28 @@ jobs:
7394 run : |
7495 git config user.name ${{ github.actor }}
7596 git config user.email ${{ github.actor }}@users.noreply.github.com
97+
98+ if [[ "${{ inputs.tag }}" == "beta" || "${{ inputs.tag }}" == "public" ]]; then
99+ git checkout ${{ env.branch_name }}
100+ fi
101+
76102 git add pom.xml
77- if ${{ inputs.is-internal }}; then
103+ if [[ " ${{ inputs.tag }}" == "internal" ]] ; then
78104 git commit -m "[AUTOMATED] Private Release ${{ steps.previoustag.outputs.tag }}-dev-$(git rev-parse --short $GITHUB_SHA)"
79105 git push origin ${{ github.ref_name }} -f
80- else
106+ fi
107+ if [[ "${{ inputs.tag }}" == "beta" || "${{ inputs.tag }}" == "public" ]]; then
81108 git commit -m "[AUTOMATED] Public Release - ${{ steps.previoustag.outputs.tag }}"
82- git push origin
109+ git push origin ${{ env.branch_name }}
83110 fi
84111
85112 - name : Create env
86- if : ${{ inputs.is-internal }}
87113 id : create-env
88114 run : |
89115 touch .env
90- echo SKYFLOW_CREDENTIALS=${{ secrets.SKYFLOW_CREDENTIALS }} >> .env
91- echo TEST_EXPIRED_TOKEN=${{ secrets.TEST_EXPIRED_TOKEN }} >> .env
116+ echo SKYFLOW_CREDENTIALS=${{ secrets.skyflow-credentials }} >> .env
117+ echo TEST_EXPIRED_TOKEN=${{ secrets.test-expired-token }} >> .env
118+ echo TEST_REUSABLE_TOKEN=${{ secrets.test-reusable-token }} >> .env
92119
93120 - name : Create credentials json
94121 id : create-json
98125 json : ${{ secrets.TEST_CREDENTIALS_FILE_STRING }}
99126
100127 - name : Publish package
101- run : mvn clean deploy -P ${{ inputs.profile }}
128+ run : mvn --batch-mode deploy -P ${{ inputs.profile }}
129+
102130 env :
103131 SERVER_USERNAME : ${{ secrets.server-username }}
104132 SERVER_PASSWORD : ${{ secrets.server-password }}
105- GPG_PASSPHRASE : ${{ secrets.gpg-passphrase }}
133+ GPG_PASSPHRASE : ${{ secrets.gpg-passphrase }}
0 commit comments