Skip to content

Commit a9585d0

Browse files
Update publish.yml
1 parent 862c2a0 commit a9585d0

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

.github/workflows/publish.yml

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

33
on:
4-
pull_request:
5-
types: [closed]
4+
push:
65
branches:
76
- main
87

9-
108
jobs:
119
publish:
12-
if: github.event.pull_request.merged == true && contains(github.event.pull_request.head.ref, 'release')
1310
runs-on: ubuntu-latest
1411
steps:
1512
- name: Checkout code
@@ -30,11 +27,21 @@ jobs:
3027
ORG_GRADLE_PROJECT_SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
3128
ORG_GRADLE_PROJECT_SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
3229

30+
- name: Check version
31+
id: version
32+
run: |
33+
version=$(grep "attributeCachingFilesystemVersion" gradle.properties | cut -d'=' -f2 | tr -d ' ')
34+
if [[ "$version" != *"SNAPSHOT"* ]]; then
35+
echo "is_release=true" >> $GITHUB_OUTPUT
36+
else
37+
echo "is_release=false" >> $GITHUB_OUTPUT
38+
fi
39+
3340
- name: Notify Central Publisher Portal
34-
if: contains(github.event.pull_request.head.ref, 'SNAPSHOT') == false
41+
if: steps.version.outputs.is_release == 'true'
3542
run: |
3643
token=$(echo -n "${{ secrets.NEXUS_USERNAME }}:${{ secrets.NEXUS_PASSWORD }}" | base64)
3744
curl -X POST \
3845
-H "Authorization: Bearer $token" \
3946
-F "publishing_type=automatic" \
40-
https://central.sonatype.com/manual/upload/defaultRepository/com.pkware.filesystem
47+
https://ossrh-staging-api.central.sonatype.com/manual/upload/defaultRepository/com.pkware.filesystem

0 commit comments

Comments
 (0)