Skip to content

Commit defecfd

Browse files
Update publish.yml
Fixed the conditionals to read from the merged in branch from a pull request. The old workflow was trying to read from the main branch to see if its reference contains `release` or `snapshot`.
1 parent 6c4c5d1 commit defecfd

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

.github/workflows/publish.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
name: Publish to Maven Central
22

33
on:
4-
push:
4+
pull_request:
5+
types: [closed]
56
branches:
67
- main
78

9+
810
jobs:
911
publish:
10-
if: contains(github.ref, 'release')
12+
if: github.event.pull_request.merged == true && contains(github.event.pull_request.head.ref, 'release')
1113
runs-on: ubuntu-latest
1214
steps:
1315
- name: Checkout code
@@ -29,7 +31,7 @@ jobs:
2931
ORG_GRADLE_PROJECT_SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
3032

3133
- name: Notify Central Publisher Portal
32-
if: contains(github.ref, 'SNAPSHOT') == false
34+
if: contains(github.event.pull_request.head.ref, 'SNAPSHOT') == false
3335
run: |
3436
token=$(echo -n "${{ secrets.NEXUS_USERNAME }}:${{ secrets.NEXUS_PASSWORD }}" | base64)
3537
curl -X POST \

0 commit comments

Comments
 (0)