1+ name : Shared Build and Deploy
2+ on :
3+ workflow_call :
4+ inputs :
5+ ref :
6+ description : ' Git reference to use (e.g., main or branch name)'
7+ required : true
8+ type : string
9+
10+ is-internal :
11+ description : ' Flag for internal release'
12+ required : true
13+ type : boolean
14+
15+ server-id :
16+ description : ' Id of the repository'
17+ required : true
18+ type : string
19+
20+ server-username :
21+ description : ' Username of the repository'
22+ required : true
23+ type : string
24+
25+ server-password :
26+ description : ' Password of the repository'
27+ required : true
28+ type : string
29+
30+ gpg-key :
31+ description : ' GPG key to access the repository'
32+ required : true
33+ type : string
34+
35+ gpg-passphrase :
36+ description : ' GPG passphrase to access the repository'
37+ required : true
38+ type : string
39+
40+ profile :
41+ description : ' Profile to pick from pom.xml'
42+ required : true
43+ type : string
44+
45+ jobs :
46+ publish :
47+ runs-on : ubuntu-latest
48+ steps :
49+ - uses : actions/checkout@v2
50+ with :
51+ ref : ${{ inputs.ref }}
52+ fetch-depth : 0
53+
54+ - name : Set up maven or jfrog repository
55+ uses : actions/setup-java@v1
56+ with :
57+ java-version : ' 1.8'
58+ distribution : ' adopt'
59+ server-id : ${{ inputs.server-id }}
60+ server-username : SERVER_USERNAME
61+ server-password : SERVER_PASSWORD
62+ gpg-private-key : ${{ inputs.gpg-key }} # Value of the GPG private key to import
63+ gpg-passphrase : GPG_PASSPHRASE # env variable for GPG private key passphrase
64+
65+ - name : Get Previous tag
66+ id : previoustag
67+ uses : WyriHaximus/github-action-get-previous-tag@v1
68+ with :
69+ fallback : 1.0.0
70+
71+ - name : Bump Version
72+ run : |
73+ chmod +x ./ci-scripts/bump_version.sh
74+ if ${{ inputs.is-internal }}; then
75+ ./ci-scripts/bump_version.sh "${{ steps.previoustag.outputs.tag }}" "$(git rev-parse --short "$GITHUB_SHA")"
76+ else
77+ ./ci-scripts/bump_version.sh "${{ steps.previoustag.outputs.tag }}"
78+ fi
79+
80+ - name : Commit changes
81+ run : |
82+ git config user.name ${{ github.actor }}
83+ git config user.email ${{ github.actor }}@users.noreply.github.com
84+ git add pom.xml
85+ if ${{ inputs.is-internal }}; then
86+ git commit -m "[AUTOMATED] Private Release ${{ steps.previoustag.outputs.tag }}-dev-$(git rev-parse --short $GITHUB_SHA)"
87+ git push origin ${{ github.ref_name }} -f
88+ else
89+ git commit -m "[AUTOMATED] Public Release - ${{ steps.previoustag.outputs.tag }}"
90+ git push origin
91+
92+ - name : Create env
93+ if : ${{ inputs.is-internal }}
94+ id : create-env
95+ run : |
96+ touch .env
97+ echo SKYFLOW_CREDENTIALS=${{ secrets.SKYFLOW_CREDENTIALS }} >> .env
98+ echo TEST_EXPIRED_TOKEN=${{ secrets.TEST_EXPIRED_TOKEN }} >> .env
99+
100+ - name : Create credentials json
101+ id : create-json
102+ uses : jsdaniell/create-json@1.1.2
103+ with :
104+ name : " credentials.json"
105+ json : ${{ secrets.TEST_CREDENTIALS_FILE_STRING }}
106+
107+ - name : Publish package
108+ run : mvn clean deploy -P ${{ inputs.profile }}
109+ env :
110+ SERVER_USERNAME : ${{ inputs.server-username }}
111+ SERVER_PASSWORD : ${{ inputs.server-password }}
112+ GPG_PASSPHRASE : ${{ inputs.gpg-passphrase }}
113+
0 commit comments