Skip to content

Commit

Permalink
Try to handle work dir change for action
Browse files Browse the repository at this point in the history
  • Loading branch information
markpatton committed Dec 12, 2023
1 parent 8f635d5 commit 4cf3d7c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 9 additions & 1 deletion .github/actions/maven-release/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ name: Release Maven module
description: |
Releases a Maven module and waits for it to appear in Sonatype.
inputs:
repodir:
description: 'Directory of repository to release'
required: false
default: '.'

runs:
using: composite
steps:
Expand All @@ -14,6 +20,7 @@ runs:
# Attempt to handle case of Sonatype failing to close the repository, but still succeeding
- name: Release Maven module and push to Sonatype
shell: bash
working-directory: ${{ inputs.repodir }}
run: |
goal="deploy"
Expand All @@ -22,12 +29,13 @@ runs:
goal="install"
fi
pwd
echo mvn -B -U -V -ntp -P release -DstagingProgressTimeoutMinutes=15 clean $goal | tee release.log
code=${PIPESTATUS[0]}
marker1="Remote staging repositories are being released"
marker2="Failed to execute goal org.sonatype.plugins:nexus-staging-maven-plugin"
if [ "$code" -ne "0" ]; then
if grep -q "$marker1" release.log && grep -q "$marker2" release.log; then
echo "Failed cleaning up after pushing to Sonatype, but it may have succeeded anyway."
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/pass-java-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ jobs:
- name: Release Java modules
working-directory: combined
uses: ./.github/actions/maven-release
with:
repodir: combined
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
Expand Down

0 comments on commit 4cf3d7c

Please sign in to comment.