Skip to content

Commit e3ab5c3

Browse files
authored
Merge pull request #222 from IABTechLab/swi-UID2-6799-maven-merge-environment
UID2-6799 Add merge_environment to shared-publish-to-maven-versioned
2 parents be5592b + 1f29842 commit e3ab5c3

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

.github/workflows/shared-publish-to-maven-versioned.yaml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ on:
2929
description: If true, will skip tests when compiling. Defaults to false. Set to true for repos without tests.
3030
type: boolean
3131
default: false
32+
merge_environment:
33+
description: GitHub Environment to use for accessing the merge token. Leave empty to use the default GITHUB_TOKEN.
34+
type: string
35+
default: ''
3236

3337
env:
3438
IS_RELEASE: ${{ (inputs.release_type == 'Major' || inputs.release_type == 'Minor' || inputs.release_type == 'Patch') && (github.event.repository.default_branch == github.ref_name ) }}
@@ -38,6 +42,7 @@ jobs:
3842
release:
3943
name: ${{ ((inputs.release_type == 'Major' || inputs.release_type == 'Minor' || inputs.release_type == 'Patch') && (github.event.repository.default_branch == github.ref_name )) && 'Create Release' || 'Publish Pre-release' }}
4044
runs-on: ubuntu-latest
45+
environment: ${{ inputs.merge_environment }}
4146
permissions:
4247
pull-requests: write
4348
contents: write
@@ -138,19 +143,21 @@ jobs:
138143
mvn -B -s settings.xml -Dgpg.passphrase="${{ secrets.GPG_PASSPHRASE }}" clean compile -DskipTests
139144
140145
- name: Commit pom.xml and version.json
141-
if: ${{ steps.checkRelease.outputs.is_release != 'true' }}
142-
uses: IABTechLab/uid2-shared-actions/actions/commit_pr_and_merge@v2
146+
if: ${{ steps.checkRelease.outputs.is_release != 'true' }}
147+
uses: IABTechLab/uid2-shared-actions/actions/commit_pr_and_merge@v3
143148
with:
144149
add: '${{ inputs.working_dir }}/pom.xml ${{ inputs.working_dir }}/version.json'
145150
message: 'Released ${{ inputs.release_type }} version: ${{ steps.version.outputs.new_version }}'
151+
github_token: ${{ inputs.merge_environment != '' && secrets.GH_MERGE_TOKEN || '' }}
146152

147153
- name: Commit pom.xml, version.json and set tag
148-
if: ${{ steps.checkRelease.outputs.is_release == 'true' }}
149-
uses: IABTechLab/uid2-shared-actions/actions/commit_pr_and_merge@v2
154+
if: ${{ steps.checkRelease.outputs.is_release == 'true' }}
155+
uses: IABTechLab/uid2-shared-actions/actions/commit_pr_and_merge@v3
150156
with:
151157
add: '${{ inputs.working_dir }}/pom.xml ${{ inputs.working_dir }}/version.json'
152158
message: 'Released ${{ inputs.release_type }} version: ${{ steps.version.outputs.new_version }}'
153-
tag: v${{ steps.version.outputs.new_version }}
159+
tag: v${{ steps.version.outputs.new_version }}
160+
github_token: ${{ inputs.merge_environment != '' && secrets.GH_MERGE_TOKEN || '' }}
154161

155162
- name: Build Changelog
156163
id: github_release

0 commit comments

Comments
 (0)