@@ -27,6 +27,10 @@ run-name: Release
2727permissions :
2828 contents : read
2929
30+ env :
31+ RELEASE_COMMIT : ${{ github.sha }}
32+ RELEASE_TAG_VERSION : ${{ inputs.version }}
33+
3034jobs :
3135 version_seal :
3236 runs-on : ubuntu-latest
@@ -114,4 +118,74 @@ jobs:
114118 name : Build (Maven)
115119 run : |
116120 mvn -B install --file pom.xml
117-
121+
122+ publish :
123+ runs-on : ubuntu-latest
124+ needs :
125+ - build
126+ environment : Release
127+ steps :
128+ - id : download_source
129+ name : Download artifacts
130+ uses : actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.6.1
131+ with :
132+ name : source
133+ - name : Setup Java
134+ uses : actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12
135+ with :
136+ distribution : corretto
137+ java-version : 21
138+ cache : maven
139+ - name : Publish package
140+ run : mvn -Prelease clean deploy -DskipTests
141+ env :
142+ MAVEN_USERNAME : ${{ secrets.OSSRH_JIRA_USERNAME }}
143+ MAVEN_PASSWORD : ${{ secrets.OSSRH_JIRA_PASSWORD }}
144+ GPG_PASSPHRASE : ${{ secrets.GPG_PASSPHRASE }}
145+
146+ create_pr :
147+ runs-on : ubuntu-latest
148+ if : ${{ inputs.snapshot == false }}
149+ needs :
150+ - publish
151+ permissions :
152+ pull-requests : write
153+ contents : write
154+ steps :
155+ - id : checkout
156+ name : Checkout repository
157+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
158+ with :
159+ ref : ${{ env.RELEASE_COMMIT }}
160+ - id : download_source
161+ name : Download artifacts
162+ uses : actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.6.1
163+ with :
164+ name : source
165+ - id : setup-git
166+ name : Git client setup and refresh tip
167+ run : |
168+ git config user.name "Powertools for AWS Lambda (Java) Bot"
169+ git config user.email "[email protected] " 170+ git config pull.rebase true
171+ git config remote.origin.url >&-
172+ - id : branch
173+ name : Create branch
174+ run : |
175+ git checkout -b ci-${{ github.run_id }}
176+ git commit -am "chore(ci): bump version to ${{ inputs.version }}"
177+ git push origin ci-${{ github.run_id }}
178+ - id : create_pr
179+ name : Create PR
180+ run : |
181+ gh pr create \
182+ --title "chore(ci): bump version to ${{ inputs.version }}" \
183+ --body "This is an automated PR created from the following workflow: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
184+ env :
185+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
186+ - id : tag
187+ name : Create release
188+ run : |
189+ gh release create v${{ inputs.version }} --target $(git rev-parse HEAD)
190+ env :
191+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments